Jelajahi Sumber

Added more stringbuilder examples.

woollybah 6 tahun lalu
induk
melakukan
91c9235256

+ 14 - 0
stringbuilder.mod/doc/tstringbuilder_appendcstring.bmx

@@ -0,0 +1,14 @@
+SuperStrict
+
+Framework BRL.StringBuilder
+Import brl.standardio
+
+Local sb:TStringBuilder = New TStringBuilder()
+
+Local b:Byte Ptr = "Hello World".ToCString()
+
+sb.AppendCString(b)
+
+MemFree(b)
+
+Print sb.ToString()

TEMPAT SAMPAH
stringbuilder.mod/doc/tstringbuilder_appendutf8string.bmx


+ 10 - 0
stringbuilder.mod/doc/tstringbuilder_insert.bmx

@@ -0,0 +1,10 @@
+SuperStrict
+
+Framework BRL.StringBuilder
+Import brl.standardio
+
+Local sb:TStringBuilder = New TStringBuilder("Hello World!")
+
+sb.Insert(6, "BlitzMax ")
+
+Print sb.ToString()

+ 12 - 0
stringbuilder.mod/doc/tstringbuilder_join.bmx

@@ -0,0 +1,12 @@
+SuperStrict
+
+Framework BRL.StringBuilder
+Import brl.standardio
+
+Local sb:TStringBuilder = New TStringBuilder(", ")
+
+Local values:String[] = ["one", "two", "three", "four", "five", "six"]
+
+Local joined:TStringBuilder = sb.Join(values)
+
+Print joined.ToString()

+ 10 - 0
stringbuilder.mod/doc/tstringbuilder_removecharat.bmx

@@ -0,0 +1,10 @@
+SuperStrict
+
+Framework BRL.StringBuilder
+Import brl.standardio
+
+Local sb:TStringBuilder = New TStringBuilder("Hello World!")
+
+sb.RemoveCharAt(4)
+
+Print sb.ToString()

+ 8 - 0
stringbuilder.mod/doc/tstringbuilder_substring.bmx

@@ -0,0 +1,8 @@
+SuperStrict
+
+Framework BRL.StringBuilder
+Import brl.standardio
+
+Local sb:TStringBuilder = New TStringBuilder("Hello World!")
+
+Print sb.SubString(6, 11)

+ 8 - 0
stringbuilder.mod/doc/tstringbuilder_tostring.bmx

@@ -0,0 +1,8 @@
+SuperStrict
+
+Framework BRL.StringBuilder
+Import brl.standardio
+
+Local sb:TStringBuilder = New TStringBuilder("Hello World!")
+
+Print sb.ToString()

+ 4 - 3
stringbuilder.mod/stringbuilder.bmx

@@ -260,7 +260,8 @@ Public
 	
 	
 	Rem
 	Rem
 	bbdoc: Appends the new line string to the string builder.
 	bbdoc: Appends the new line string to the string builder.
-	about: The new line string can be altered using #SetNewLineText. This might be used to force the output to always use Unix line endings even when on Windows.
+	about: The new line string can be altered using #SetNewLineText. This might be used to force the output to always
+	use Unix line endings even when on Windows.
 	End Rem
 	End Rem
 	Method AppendNewLine:TStringBuilder()
 	Method AppendNewLine:TStringBuilder()
 		If newLine Then
 		If newLine Then
@@ -587,8 +588,8 @@ End Type
 
 
 Rem
 Rem
 bbdoc: An array of split text from a TStringBuilder.
 bbdoc: An array of split text from a TStringBuilder.
-about: Note that the #TSplitBuffer is only valid while its parent TStringBuilder is unchanged.
-Once you modify the TStringBuffer you should call Split() again.
+about: Note that the #TSplitBuffer is only valid while its parent #TStringBuilder is unchanged.
+Once you modify the #TStringBuffer you should call Split() again.
 End Rem
 End Rem
 Type TSplitBuffer
 Type TSplitBuffer
 Private
 Private