Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Parsing a string..
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Parsing a string..

 Post Reply Post Reply
Author
Diep-Vriezer View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
Post Options Post Options   Thanks (0) Thanks(0)   Quote Diep-Vriezer Quote  Post ReplyReply Direct Link To This Post Topic: Parsing a string..
    Posted: 25 October 2003 at 11:43am

Hey again,

I'm building an authentification module, and I need to allow multiple users. This is NOT done using standard IIS security, thus, NOT in the web.config file.

What I need to do is this. I have a string called Allowed. Now, in that string, I can place user names, devided by a ';' and a ' '. So, how can I sort of search the string for a ';' and a ' ' and make a breakpoint or something to divide the string into pieces? This must be possible, but how?

Gone..
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 25 October 2003 at 12:20pm

Use the split Function:

Dim arrvalues

arrvalues = split(string, ";")

it will then put all the bits into an array.

Back to Top
Diep-Vriezer View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
Post Options Post Options   Thanks (0) Thanks(0)   Quote Diep-Vriezer Quote  Post ReplyReply Direct Link To This Post Posted: 25 October 2003 at 4:25pm
aha, thx. All of you out there, thx alot, now I can build my thing
Gone..
Back to Top
The WizeGuy View Drop Down
Newbie
Newbie


Joined: 02 October 2003
Location: Sweden
Status: Offline
Points: 34
Post Options Post Options   Thanks (0) Thanks(0)   Quote The WizeGuy Quote  Post ReplyReply Direct Link To This Post Posted: 25 October 2003 at 4:41pm

But!

It should look like this, my opinion.

Dim _values As String()
Dim stringToSplit As String = "Admin;Moderator;User"

Dim _values = strintToSplit.Split(";")

cya,
/PatrikB

Back to Top
Diep-Vriezer View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
Post Options Post Options   Thanks (0) Thanks(0)   Quote Diep-Vriezer Quote  Post ReplyReply Direct Link To This Post Posted: 26 October 2003 at 2:32am
So what is in the _values string now?
Gone..
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 26 October 2003 at 5:02am

But!

What i posted does the same thing and doesnt confuse anyone cos i explained it...

Back to Top
The WizeGuy View Drop Down
Newbie
Newbie


Joined: 02 October 2003
Location: Sweden
Status: Offline
Points: 34
Post Options Post Options   Thanks (0) Thanks(0)   Quote The WizeGuy Quote  Post ReplyReply Direct Link To This Post Posted: 26 October 2003 at 5:56am
Originally posted by Mart Mart wrote:

But!

What i posted does the same thing and doesnt confuse anyone cos i explained it...

What You did is OLD VB code ... why not use the new things added to VB.NET instead?

_value contains a string array (As String()) and You can loop through it like this:

Dim i As Integer
For i = 0 TO (_value.length - 1)
 Dim _tmp As String = _value(i)
Next

 

just my €0.02

cya,
/PatrikB

Back to Top
Diep-Vriezer View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
Post Options Post Options   Thanks (0) Thanks(0)   Quote Diep-Vriezer Quote  Post ReplyReply Direct Link To This Post Posted: 26 October 2003 at 2:08pm
Okay
Gone..
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.