Time for an 2014 update…

This commit is contained in:
Ingy döt Net 2014-01-17 05:32:22 +00:00
parent 372c577f83
commit 09687c4926
2520 changed files with 34227 additions and 7318 deletions

View file

@ -0,0 +1,20 @@
100 T$ = "HELLO,HOW,ARE,YOU,TODAY"
110 GOSUB 200"TOKENIZE
120 FOR I = 1 TO N
130 PRINT A$(I) "." ;
140 NEXT
150 PRINT
160 END
200 IF N = 0 THEN DIM A$(256)
210 N = 1
220 A$(N) = "
230 FOR TI = 1 TO LEN(T$)
240 C$ = MID$(T$, TI, 1)
250 T = C$ = ","
260 IF T THEN C$ = "
270 N = N + T
280 IF T THEN A$(N) = C$
290 A$(N) = A$(N) + C$
300 NEXT TI
310 RETURN

View file

@ -0,0 +1,14 @@
Sub Main()
Dim parseMe As String, parsed As Variant
parseMe = "Hello,How,Are,You,Today"
parsed = Split(parseMe, ",")
Dim L0 As Long, outP As String
outP = parsed(0)
For L0 = 1 To UBound(parsed)
outP = outP & "." & parsed(L0)
Next
MsgBox outP
End Sub

View file

@ -0,0 +1,8 @@
INSTALL @lib$+"STRINGLIB"
text$ = "Hello,How,Are,You,Today"
n% = FN_split(text$, ",", array$())
FOR i% = 0 TO n%-1
PRINT array$(i%) "." ;
NEXT
PRINT

View file

@ -0,0 +1,7 @@
'Note that Liberty Basic's array usage can reach element #10 before having to DIM the array
For i = 0 To 4
array$(i) = Word$("Hello,How,Are,You,Today", (i + 1), ",")
array$ = array$ + array$(i) + "."
Next i
Print Left$(array$, (Len(array$) - 1))

View file

@ -0,0 +1,15 @@
FUNCTION PBMAIN () AS LONG
DIM parseMe AS STRING
parseMe = "Hello,How,Are,You,Today"
REDIM parsed(PARSECOUNT(parseMe) - 1) AS STRING
PARSE parseMe, parsed() 'comma is default delimiter
DIM L0 AS LONG, outP AS STRING
outP = parsed(0)
FOR L0 = 1 TO UBOUND(parsed) 'could reuse parsecount instead of ubound
outP = outP & "." & parsed(L0)
NEXT
MSGBOX outP
END FUNCTION

View file

@ -0,0 +1,10 @@
NewList MyStrings.s()
For i=1 To 5
AddElement(MyStrings())
MyStrings()=StringField("Hello,How,Are,You,Today",i,",")
Next i
ForEach MyStrings()
Print(MyStrings()+".")
Next

View file

@ -0,0 +1 @@
Print(ReplaceString("Hello,How,Are,You,Today",",","."))

View file

@ -0,0 +1,5 @@
text$ = "Hello,How,Are,You,Today"
FOR i = 1 to 5
textArray$(i) = word$(text$,i,",")
print textArray$(i);" ";
NEXT

View file

@ -0,0 +1 @@
WScript.Echo Join(Split("Hello,How,Are,You,Today", ","), ".")

View file

@ -0,0 +1 @@
(clojure.string/join "." (clojure.string/split "Hello,How,Are,You,Today" #","))

View file

@ -0,0 +1 @@
!print join "." split "Hello,How,Are,You,Today" ","

View file

@ -1,17 +1,17 @@
/*REXX program to seperate a string of comma-delimited words, and echo. */
/*REXX program seperates a string of comma-delimited words, and echoes. */
sss = 'Hello,How,Are,You,Today' /*words seperated by commas (,). */
say 'input string='sss /*display the original string. */
say 'input string =' sss /*display the original string. */
new=sss /*make a copy of the string. */
do items=1 until new=='' /*keep going until SSS is empty. */
parse var new a.items ',' new /*parse words delinated by comma.*/
end /*items*/
/* [↓] string NEW is destroyed. */
do items=1 until new=='' /*keep going until NEW is empty.*/
parse var new a.items ',' new /*parse words delinated by comma.*/
end /*items*/ /* [↑] the array is named A. */
say; say 'Words in the string:' /*display a header for the list. */
do k=1 for items /*now, display all the words. */
say a.k'.' /*append a period to the word. */
end /*k*/
do j=1 for items /*now, display all the words. */
say a.j || left('.', j\==items) /*append period to word, maybe. */
end /*j*/ /* [↑] don't append "." if last.*/
say 'End-of-list.' /*display a trailer for the list.*/
/*stick a fork in it, we're done.*/