Hey all,
I have a file name like Eng-Cat-01-01-01.txt. I need to do a loop that
starts stripping the letters from the front of this file name (which
I'll store as a variable) until it reaches the "Cat" part. So I would
have a variable "Cat-01-01-01.txt" that I can use to build up another
string.
Trouble is, I'm lost. Can't figure out how to do this in VB.net. Could
anyone point me in the right direction?
MANY thanks!
cm 7 1382
You should probably convert the strings to all upper or all lower case, but
this is the idea.
Dim fn As String = "Eng-Cat-01-01-01.txt"
Console.Out.Wri teLine(fn.Subst ring(fn.IndexOf ("Cat")))
"Benway" wrote:
Hey all,
I have a file name like Eng-Cat-01-01-01.txt. I need to do a loop that
starts stripping the letters from the front of this file name (which
I'll store as a variable) until it reaches the "Cat" part. So I would
have a variable "Cat-01-01-01.txt" that I can use to build up another
string.
Trouble is, I'm lost. Can't figure out how to do this in VB.net. Could
anyone point me in the right direction?
MANY thanks!
cm
Benway wrote:
I have a file name like Eng-Cat-01-01-01.txt. I need to do a loop
that starts stripping the letters from the front of this file name
(which I'll store as a variable) until it reaches the "Cat" part. So I
would have a variable "Cat-01-01-01.txt" that I can use to build up
another string.
Dim sFilename As String _
= "Eng-Cat-01-01-01.txt"
Dim iPos as Integer _
= sFilename.Index of( "Cat" )
If iPos -1 Then
? sFilename.SubSt ring( 0, iPos )
? sFilename.SubSt ring( iPos + "Cat".Lengt h() + 1 )
' or thereabouts ...
HTH,
Phill W.
Phill W. wrote:
Benway wrote:
>I have a file name like Eng-Cat-01-01-01.txt. I need to do a loop that starts stripping the letters from the front of this file name (which I'll store as a variable) until it reaches the "Cat" part. So I would have a variable "Cat-01-01-01.txt" that I can use to build up another string.
Dim sFilename As String _
= "Eng-Cat-01-01-01.txt"
Dim iPos as Integer _
= sFilename.Index of( "Cat" )
If iPos -1 Then
? sFilename.SubSt ring( 0, iPos )
? sFilename.SubSt ring( iPos + "Cat".Lengt h() + 1 )
' or thereabouts ...
HTH,
Phill W.
Thanks guys!
cm
Benway wrote:
Hey all,
I have a file name like Eng-Cat-01-01-01.txt. I need to do a loop
that starts stripping the letters from the front of this file name
(which I'll store as a variable) until it reaches the "Cat" part. So I
would have a variable "Cat-01-01-01.txt" that I can use to build up
another string.
Trouble is, I'm lost. Can't figure out how to do this in VB.net. Could
anyone point me in the right direction?
MANY thanks!
cm
Hey guys, one more thing you might be able to help with: I've got a
string of text in a label (about 10 or so letters). I need to search it
for "Mit" and replace it with "Cat". Any ideas?
Thanks again!
cm
Benway wrote:
I've got a string of text in a label (about 10 or so letters).
I need to search it for "Mit" and replace it with "Cat".
Any ideas?
So you want to "Replace" one value in a "String" with a different value?
There's a couple of keywords for you to look up ... ;-)
Do you have MSDN installed or do you have access to it on the Web?
Without it, you're going to be /really/ struggling to get to grips with
the Framework and all its classes and methods.
HTH,
Phill W.
Benway wrote:
Hey guys, one more thing you might be able to help with: I've got a
string of text in a label (about 10 or so letters). I need to search
it for "Mit" and replace it with "Cat". Any ideas?
SomeText=Replac e(SomeText, "Mit", "Cat")
Andrew
Phill W. wrote:
Benway wrote:
>I've got a string of text in a label (about 10 or so letters). I need to search it for "Mit" and replace it with "Cat". Any ideas?
So you want to "Replace" one value in a "String" with a different value?
There's a couple of keywords for you to look up ... ;-)
Do you have MSDN installed or do you have access to it on the Web?
Without it, you're going to be /really/ struggling to get to grips with
the Framework and all its classes and methods.
HTH,
Phill W.
Yeah, thanks for pointing me to Google. I'll check there more
thoroughly in the future.
cm This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ralph Freshour |
last post by:
I'm taking text from a textarea object and want to strip out
characters other than A-Za-z0-9 before I send the data to MySQL table
- is there a function I can use to do this in PHP?
Thanks...
|
by: Jeff North |
last post by:
Hi,
I'm using a control called HTMLArea which allows a person to enter
text and converts the format instructions to html tags. Most of my
users know nothing about html so this is perfect for my use.
http://www.interactivetools.com/products/htmlarea/
This only works with IE5.5+.
What I need to do is to take this html formatted text and only display
part of the text on a web page (much like a news article which shows
only part of the...
|
by: Raj |
last post by:
Hi
I was hoping someone could suggest a simple way of stripping non-numeric
data from a string of numbers.
For example, if I have "ADB12458789\n"
I would like to remove the letters and the newline from this string.
I am new to C so am sure this is simple ut I don't know how to do it! Sorry!
|
by: Mikey |
last post by:
Sample VB .NET source code to create mailing labels or customized letters
using MS Word MailMerge
This VB .NET source code will start MS Word and call methods and set
properties in MS Word to execute a MailMerge to create mailing labels or
customized letters.
A label name known to MS Word MailMerge mailing label wizard may be used or
a template file containing the field names Line1 thru Line5 for each record
to be printed. If a...
|
by: Edward Elliott |
last post by:
I'm looking for the "best" way to strip a large set of chars from a filename
string (my definition of best usually means succinct and readable). I
only want to allow alphanumeric chars, dashes, and periods. This is what I
would write in Perl (bless me father, for I have sinned...):
$filename =~ tr/\w.-//cd, or equivalently
$filename =~ s///
I could just use re.sub like the second example, but that's a bit overkill.
I'm trying to...
| |
by: Greg Larsen |
last post by:
I have a string that contains both the filename and the directory. Something
like "c:\temp\test.txt". I need a process that will take this string and
return only the file portion "text.txt". How might I do this. Kept in mind
sometimes the string may contain "C:/temp/test.txt". Any ideas?
|
by: euniceno1 |
last post by:
the problem is to count the letters and sequence from a file. the fist thing of my code is to read file and in the main function i create is to count the characters and sequence by using 2 dimension array.
where the character include letters and spaces.
I am just learning c language at the moment, i have problem with following program:
#define TRUE 1
#define FALSE 0
#define MAX_LENGTH 100000 /* Max number of chars read from file */...
|
by: dpreston74 |
last post by:
Hello forum.
I need to learn how write a SQL script to strip 0s from data and strip alpha letters from alpha numeric data.
e.g.
I get data like 054, 006, 903, for a dept number. I need to strip the leading zeros from right. and keep the rest of the numbers. Whats the best way to script this striping?
Also,
|
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...
|
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...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
| |
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |