473,799 Members | 2,934 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2687
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*******@yaho o.com> wrote in message
news:#C******** ******@TK2MSFTN GP09.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***@catamara nco.com> wrote in message
news:eV******** ******@tk2msftn gp13.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*******@yaho o.com> wrote in message
news:#C******** ******@TK2MSFTN GP09.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***@catamara nco.com> wrote in message
news:OX******** ******@TK2MSFTN GP12.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
26175
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 in a table -or- whatever... Can anyone help me locate the commands (samples) that might do this? Actually, I want to read a file and use these comma seperated groups of data to "load" a database and this comma seperated data is the individual...
4
2276
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 values and separators class { private string globalvar = ""; private void manipulate (whattodo ) //substring, join, etc....
32
14905
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 ((someString.IndexOf("something1",0) >= 0) || ((someString.IndexOf("something2",0) >= 0) ||
4
3477
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 able to extract the part after the number and before the _.
4
1695
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 the ..) From example 1 I need "23" returned From example2 I need "1" Returned From Example3 I need "12345" returned
10
1778
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 line and not the others. If i use re module, how to compile the expression to do this? I tried the re module and using simple
2
1576
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 as hyperlinks, because obviously they don't gave the link tags around them. What I'd like is to manipulate this text string so that wherever there is http in it it put's the link tags around it. So what I'm really asking is, how can I convert...
7
3779
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 of the active areas hidden from users. I have a page named test.htm that includes a file get.php in a <scripttag that will dynamically generate some javascript to write the imagemap. The get.php file will write a unique key to a session that will...
0
10604
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 characters or simply matching a single character) : ANSI-89 - Mainly used only by Jet / ACE SQL ANSI-92 - Mainly used by SQL Server and other grown-up products In the later versions of Access it is now possible to select ANSI-92 compatibility as an...
0
9688
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9546
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10491
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10268
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10247
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7571
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2941
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.