Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: samshosho on September 23, 2015, 09:39:39 AM

Title: UIinput.value.Insert doesn't seem to work!
Post by: samshosho on September 23, 2015, 09:39:39 AM
I have a string, that i want to insert at the end of the UIinput value.
So i did this,

CurIndex = UIinput.value.Length;
UIinput.value.Inser(CurIndex, "some string");

It shows the correct index of the UIinput field, however, it won't insert the "some string" at all.

Am i doing something wrong ?
Title: Re: UIinput.value.Insert doesn't seem to work!
Post by: samshosho on September 25, 2015, 06:20:17 AM
any help would be appreciated :)
Title: Re: UIinput.value.Insert doesn't seem to work!
Post by: betodeoliveira on September 26, 2015, 12:26:55 AM
I think this might work:

UIinput.value = UIinput.value + "some string";
Title: Re: UIinput.value.Insert doesn't seem to work!
Post by: mcarriere on September 26, 2015, 01:50:23 PM
This is because string.Insert returns the new string you are editing, it doesn't edit the existing one: https://msdn.microsoft.com/en-us/library/system.string.insert(v=vs.110).aspx

betodeoliveira's suggestion will do what you're looking for, the main bit is that he's setting the UIinput.value