Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
That just removes all of the spaces
https://docs.yoyogames.com/source/dadiospice/002_reference/strings/string_replace_all.html
for ( var i = 0; i < string_length(str1)); i++)
{
var st = string_char_at(str1, i);
if st = " "
{
str1 = string_;
break;
}
else string_ += st;
}
thanks, works great now, but an 'n' is added to my example output. this is what I used:
First, change if string_pos(" ",user)!= 0 to if temp!= 0.
This has nothing to do with the error, temp just already stores that function's result, so this is probably faster/more efficient/more optimized.
Then, change string_length(user)-temp to string_length(user)-temp+1.
This is the actual cause of the error. It was one character too short. Good thing I included "untested" when I said "untested example".
(I have now edited my previous comment to reflect both of these things.)
Also, just to make sure, is it intentional that you're affecting global.user if there is a space in the string, but global.usersys if there isn't?
And is there a particular reason that you are using curly brackets ( { } ) around the if case's thing but not the else case's thing, when in both cases only one thing is done as a result?
Global.user does not exist, that was my mistake when I edited the code to post. As for the curley brackets.. that’s just an odd habit ¯\_(ツ)_/¯
Thanks for pointing it out though