View Full Version : Subtract text from variable
Moczulak
10th January 2014, 20:47
Hey, how to subtract a piece of text from variable?
self.variable="1234567890";
self.variable-="0";
I tried but to no avail, help me someone in this thread?
IzNoGoD
10th January 2014, 20:48
getsubstr()
serthy
10th January 2014, 20:51
substring = getSubStr( string , startIndex , endIndex ); //if endIndex is not set, it may default to string.size
string = "1234567890";
substring = getSubStr( string , 0 , string.size - 1 ); //skip last char '0'
Mitch
10th January 2014, 21:31
substring = getSubStr( string , startIndex , endIndex ); //if endIndex is not set, it may default to string.size
string = "1234567890";
substring = getSubStr( string , 0 , string.size - 1 ); //skip last char '0'
Shouldn't 'string.size - 1' be 'string.size -2'? Because index start at 0 and ends in this case at 9. 'string.size - 1' won't remove any chararacter.
Ok, i am wrong. It will return '12345678'.
Documentation says 'Returns the substring of characters >= <start index> and < <end index>. <end index> is optional';
serthy
11th January 2014, 09:29
Shouldn't 'string.size - 1' be 'string.size -2'? Because index start at 0 and ends in this case at 9. 'string.size - 1' won't remove any chararacter.
some pitfalls of codscript ^__^
Moczulak
11th January 2014, 21:54
Thank you serthy :)
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.