Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Stripping a string...how?

Author
Message
Qqite
16
Years of Service
User Offline
Joined: 28th Feb 2010
Location: Florida, U.S.
Posted: 29th Jan 2012 07:35
This not really of question of "how do I" but rather question of "how do I do this without taking up so much time?"

I'm trying to cut any character out of a string that is not a number, letter, valid punctuation mark, or space. What I'm talking about if those pesky return characters and such.

Is there an easy way to just delete all characters that are not valid visual characters?

I know I COULD list out all 345346456546 characters to check but that seems so slow.

Thanks in advance,
Qqite

Ventures of the worlds around us are limited only by our imagination.
Hodgey
16
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 29th Jan 2012 08:16
Quote: "I know I COULD list out all 345346456546 characters to check but that seems so slow."

Well, in the end, you will have to check against every character in the string won't you?

You can make checking somewhat efficient by checking against ASCII numbers and eliminate the possibilites that way.
E.g If asc(your_char) < 32 then delete_your_char()

Of course there will be more conditions to check.

Qqite
16
Years of Service
User Offline
Joined: 28th Feb 2010
Location: Florida, U.S.
Posted: 29th Jan 2012 09:18
Wow, I just checked the ascii chart and everything under 32 is the junk I don't need.

Well...that was easy. Now I just need to find out why my file reader is failing. ONWARD!

Thanks Hodgey

Ventures of the worlds around us are limited only by our imagination.
Hodgey
16
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 29th Jan 2012 09:57
That's it? Well that was quick. Good luck with the next bug.

Login to post a reply

Server time is: 2026-07-10 00:43:28
Your offset time is: 2026-07-10 00:43:28