Print Page | Close Window

Parsing a string..

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: ASP.NET Discussion
Forum Description: Discussion and chat on ASP.NET related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=6707
Printed Date: 29 March 2026 at 4:25am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Parsing a string..
Posted By: Diep-Vriezer
Subject: Parsing a string..
Date 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..



Replies:
Posted By: Mart
Date 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.



Posted By: Diep-Vriezer
Date Posted: 25 October 2003 at 4:25pm
aha, thx. All of you out there, thx alot, now I can build my thing

-------------
Gone..


Posted By: The WizeGuy
Date 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



Posted By: Diep-Vriezer
Date Posted: 26 October 2003 at 2:32am
So what is in the _values string now?

-------------
Gone..


Posted By: Mart
Date Posted: 26 October 2003 at 5:02am

But!

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



Posted By: The WizeGuy
Date 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



Posted By: Diep-Vriezer
Date Posted: 26 October 2003 at 2:08pm
Okay

-------------
Gone..



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net