New topic: Removing of a character added in a text entry field
<http://forums.realsoftware.com/viewtopic.php?t=45646> Page 1 of 1 [ 4 posts ] Previous topic | Next topic Author Message JayBird Post subject: Removing of a character added in a text entry fieldPosted: Fri Oct 19, 2012 6:37 pm Joined: Thu Mar 17, 2011 6:12 pm Posts: 58 Hi All, Im sure this is simple but i cannot seem to find the answer. I have a date that is placed in a text filed by another method. The date is placed in like: Friday, 31st November 2011 I was wondering if there is a way to remove the "," when i save the data into a text file? Is there some kind of find and replace method available? The reason i ask is i am saving this data into a CSV file so the presence of the , causes the data to break. Top charonn0 Post subject: Re: Removing of a character added in a text entry fieldPosted: Fri Oct 19, 2012 6:42 pm Joined: Mon Apr 02, 2007 2:08 am Posts: 924 Location: San Francisco, CA, USA There's the Replace function, which will replace the first occurrence of a string with another string, and the ReplaceAll function which replaces all occurrences of a string with another string: Dim d As String = "Friday, 31st November 2011" d = Replace(d, ",", "") //Replace(Source, SearchString, ReplacementString) _________________ Boredom Software Top JayBird Post subject: Re: Removing of a character added in a text entry fieldPosted: Fri Oct 19, 2012 6:49 pm Joined: Thu Mar 17, 2011 6:12 pm Posts: 58 Thanks charonn0 The date is never going to be the same, so where the date is would you reference the string as Dim datebox as currentdatefield.text Dim datebox As String datebox = Replace(datebox, ",", "") Top charonn0 Post subject: Re: Removing of a character added in a text entry fieldPosted: Fri Oct 19, 2012 7:28 pm Joined: Mon Apr 02, 2007 2:08 am Posts: 924 Location: San Francisco, CA, USA JayBird wrote:Thanks charonn0 The date is never going to be the same, so where the date is would you reference the string as Dim datebox as currentdatefield.text Dim datebox As String datebox = Replace(datebox, ",", "") Yes, but you're declaring datebox twice which won't work, and the first declaration will raise an error since you didn't declare a valid type (currentdatefield.text is not a type.) Take a look at the docs on the Dim statement for a description of valid syntaxes. This will work: Dim datebox as String = currentdatefield.text datebox = Replace(datebox, ",", "") _________________ Boredom Software Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 4 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
