473,396 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

string manipulation - seperate everyting before the underscore and after

How do I seperate the "chk_" and "33" in the following string:

chk_33

Thanks Jason

Jul 19 '05 #1
6 2635
jason wrote:
How do I seperate the "chk_" and "33" in the following string:

chk_33

Thanks Jason


dim ar, str
str = "chk_33"
ar=split(str,"_")
'ar(0) contains "chk"
'ar(1) contains "33"

HTH,
Bob Barrows
Jul 19 '05 #2
Thanks - but I cannot do it that way because I may have other form values
seperated by an "_" underscore eg: "address_1"

My form collection will be returning:
chk_69
chk_33
chk_32
etc
txt_12
etc

....I don't think that function will do the trick?
"Bob Barrows" <re*******@yahoo.com> wrote in message
news:#C**************@TK2MSFTNGP09.phx.gbl...
jason wrote:
How do I seperate the "chk_" and "33" in the following string:

chk_33

Thanks Jason


dim ar, str
str = "chk_33"
ar=split(str,"_")
'ar(0) contains "chk"
'ar(1) contains "33"

HTH,
Bob Barrows

Jul 19 '05 #3
...I should rephrase that:

When I iterate the form collection I need to isolate all the controls which
have the prefix: "chk_"

....and then complete the seperation - is this possible?

-Jason

"jason" <ja***@catamaranco.com> wrote in message
news:eV**************@tk2msftngp13.phx.gbl...
Thanks - but I cannot do it that way because I may have other form values
seperated by an "_" underscore eg: "address_1"

My form collection will be returning:
chk_69
chk_33
chk_32
etc
txt_12
etc

...I don't think that function will do the trick?
"Bob Barrows" <re*******@yahoo.com> wrote in message
news:#C**************@TK2MSFTNGP09.phx.gbl...
jason wrote:
How do I seperate the "chk_" and "33" in the following string:

chk_33

Thanks Jason


dim ar, str
str = "chk_33"
ar=split(str,"_")
'ar(0) contains "chk"
'ar(1) contains "33"

HTH,
Bob Barrows


Jul 19 '05 #4
> Thanks - but I cannot do it that way because I may have other form values
seperated by an "_" underscore eg: "address_1"


Can't you control that, and *not* that character for other meaningless
separations?

If you really must support something like chk_address_1 then look at the
MID() and INSTR() functions.
Jul 19 '05 #5
Jason,

Most of your posts today relate to our original exchage. Please check out my
reply to you under the 'Re: Multiple insert - iterate form collection -
checkbox name dynamic?' thread. The rest of your queries will be answered
too.

Cheers,

Alan

"jason" <ja***@catamaranco.com> wrote in message
news:OX**************@TK2MSFTNGP12.phx.gbl...
How do I seperate the "chk_" and "33" in the following string:

chk_33

Thanks Jason

Jul 19 '05 #6
jason wrote:
Thanks - but I cannot do it that way because I may have other form
values seperated by an "_" underscore eg: "address_1"
So? ar(0) will contain "address" and ar(1) will contain "1"? What's the
problem?

My form collection will be returning:
chk_69
chk_33
chk_32
etc
txt_12
etc

...I don't think that function will do the trick?


Why not? You don't know how to use an If statement? Try this:

for each x in request.form
'check to see if a "_" is present:
if instr(x,"_")>0 then
ar=split(x,"_")
if ar(0) = "chk" then
'we have a winner - do what you want with the variable:
y = ar(1)
else
'do nothing
end if
end if
next

Bob Barrows

Jul 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: PaulThomas | last post by:
I want to "look" through a comma delimited String and "take it apart" by finding the comma's and then put each "set of characters" into seperate strings - - - maybe an array, maybe seperate cells...
4
by: Dim | last post by:
I found that C# has some buggy ways to process string across methods. I have a class with on global string var and a method where i add / remove from this string Consider it a buffer... with some...
32
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if...
4
by: Rhonda Tipton | last post by:
Hello. I am trying to do a substring or something like that to extract the middle portion of a string. 12345 TEST FACILITY 1_Letter 1A 12346 TEST FACILITY 2_Letter 1A I would like to be...
4
by: Keith Kowalski | last post by:
I am passing in a string of varied length Example1: mil2345_23.lst Example2: mil23456_1.lst Example3: mil5567_1234.lst What I need is to parse out all text after the _ (underscore) and before...
10
by: micklee74 | last post by:
hi if i have a some lines like this a ) "here is first string" b ) "here is string2" c ) "here is string3" When i specify i only want to print the lines that contains "string" ie the first...
2
by: Sergio Orrego | last post by:
I have a text string which comes from a form containing the article text in a knowledgebase. Sometimes people enter http links in their text however when they show on the webpage they do not show...
7
by: trey.bason | last post by:
I know everyone who uses javascript at some point tries to think of a way to hide it from curious users/hackers, so here goes my question. I am trying to display an image map and keep the coords...
0
NeoPa
by: NeoPa | last post by:
ANSI-89 v ANSI-92 Before we get into all the various types of pattern matching that can be used, there are two ANSI standards used for the main types of wildcard matching (matching zero or more...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.