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.

Code Snippets / string function

Author
Message
Yian
21
Years of Service
User Offline
Joined: 16th Jun 2003
Location: Nicosia, Cyprus(the Greek half)
Posted: 29th Nov 2006 03:51 Edited at: 30th Nov 2006 02:40
say you have tags in a string eg
[chat]blabla[/chat][p]23.2435[/p]
this program will get you the info in between the specified tag



What is happening to them[the children] is the only thing they've known. The whole system of values is turned upside down: a child is appreciated and loved if it earns money by stealing
Vampiric
18
Years of Service
User Offline
Joined: 30th Oct 2006
Location:
Posted: 29th Nov 2006 18:08
cool great for say a custom script parser

All bow down to evil
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 29th Nov 2006 20:19
Yeah very awesome my man!

Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 30th Nov 2006 00:42
I tried my own version and the result is...




Yian
21
Years of Service
User Offline
Joined: 16th Jun 2003
Location: Nicosia, Cyprus(the Greek half)
Posted: 30th Nov 2006 02:40
that is quite different.

What is happening to them[the children] is the only thing they've known. The whole system of values is turned upside down: a child is appreciated and loved if it earns money by stealing
Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 30th Nov 2006 04:05


Well it still reads between the tags, it just uses a different method.


Yian
21
Years of Service
User Offline
Joined: 16th Jun 2003
Location: Nicosia, Cyprus(the Greek half)
Posted: 30th Nov 2006 04:45 Edited at: 30th Nov 2006 05:17
please try to test what you post. it doesn't even take care of the [/a] (ending tag), and when you use more than one tag,
eg [bs]bla[/bs][a]bla[/a] it just returns everything after the first ']'.

What is happening to them[the children] is the only thing they've known. The whole system of values is turned upside down: a child is appreciated and loved if it earns money by stealing
Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 30th Nov 2006 22:42
?

My code defintely removed both tags... and you edited your example. Before it just had "[a]blah[/a]" and it gave "blah" with the function. Mine does the same thing.

You edited your post to have "[a]this is a[/a]this is b[poo]this is poo[/poo]". I didn't even know yours could do that since you only used one tag in your example.


Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 1st Dec 2006 04:38
What about nested tags?

[poo]some cool[bs]blah[/bs] thing[/poo]

Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 2nd Dec 2006 04:57
Woah, good point Phealex

Man, if someone could accomplish that, you'd see new HTML editors wipping out in the WIP board

-Mansoor Siddiquie

Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 3rd Dec 2006 19:15
I once wrote a code like that...
But it was a bit more... well.. generally bigger.

It searched for tag contents when you specified start and end chars (like < and >, then you could use it to search what was written between those tags.
I also wrote some variations for ini files and such...

AAAAND finally I deleted them because no one was interested...

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
Jay Bee
18
Years of Service
User Offline
Joined: 15th Jul 2006
Location: Ashford, Kent, England
Posted: 4th Dec 2006 02:49
definately better for bugs sake to do it properly the Sven B way tbh, cool function though.

Login to post a reply

Server time is: 2024-11-22 23:10:04
Your offset time is: 2024-11-22 23:10:04