how to get mid() and/or substring?
Monkey Forums/Monkey Programming/how to get mid() and/or substring?
| ||
Hey, am i blind? or does the String class really dont have a .mid() or substring() method? actually i do it this way: Local chars:int[] = str.ToChars() chars = chars.Resize(chars.Length() -1) str= String.FromChars(chars) (in this case to remove the last char of the string) is there any nicer way? |
| ||
But we have slicing:Global Whole$, Part$ Whole="abcdef" Part=Whole[2..3] See manual part "Language Reference" chapter "The String Type" |
| ||
If it helps, you can also...Print "abcdefg"[..4] Print "abcdefg"[4..] Local i:Int=4 Print "abcdefg"[i..] |