Accessing a string sequentially
BlitzMax Forums/BlitzMax Beginners Area/Accessing a string sequentially You probably have to cast the new character as a string.
The a[] array is a string pointer, pointing to a string. It probably only accepts strings as content.
Try
For Local b:Int = 0 Until a.length
a[b] = String(Chr(65 + b)) 'Doesn't work
Next
I dont know if that works or not
The a[] array is a string pointer, pointing to a string. It probably only accepts strings as content.
Try
For Local b:Int = 0 Until a.length
a[b] = String(Chr(65 + b)) 'Doesn't work
Next
I dont know if that works or not
you can't treat a string quite like you can an array.
stringy:String="something" Print Stringy StrInsert(stringy, "test", 4) Print Stringy StrReplaceIndex(stringy, "-", 4) StrReplaceIndex(stringy, "-", 5) StrReplaceIndex(stringy, "-", 6) StrReplaceIndex(stringy, "-", 7) Print stringy StrFillRange(stringy, "*", 4, 7) Print Stringy StrFillRange(stringy, ".", 4, 7) Print stringy Rem Inserts inString into the SourceStr at the specified index and expands the string to accommodate the change EndRem Function StrInsert(SourceStr:String Var, inString:String, Index:Int) SourceStr = SourceStr[..Index] + inString + SourceStr[Index..] End Function Function StrReplaceIndex(SourceStr:String Var, replaceString:String, Index:Int) SourceStr = SourceStr[..Index] + replaceString + SourceStr[Index+1..] End Function Function StrFillRange(SourceStr:String Var, ReplaceString:String, StartIndex:Int, EndIndex:Int) For Local i = StartIndex To EndIndex StrReplaceIndex(SourceStr, ReplaceString, i) Next End Function
I guess I can't do it then.
Thanks for the alternatives everyone.
Thanks for the alternatives everyone.