473,387 Members | 1,650 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,387 software developers and data experts.

Removing strings

I have a file below
16_vir24CE.log
How can i remove 16_ or 123_
I want to have "vir24CE.log" as my output file
Dec 1 '05 #1
2 1301
If the underscore is always the separator, the simplest method would be to
get the IndexOf("_") and the a substring based on that value.

something like

string newFilename = oldName.SubString(oldName.IndexOf("_") +1);

otherwise if your pattern is more complicated, you'll need to use a regular
expression.

Karl

--

MY ASP.Net tutorials
http://www.openmymind.net/

"Patrick.O.Ige" <na********@hotmail.com> wrote in message
news:u4**************@TK2MSFTNGP15.phx.gbl...
I have a file below
16_vir24CE.log
How can i remove 16_ or 123_
I want to have "vir24CE.log" as my output file

Dec 1 '05 #2
Thx Karl i ended up using Regex like so
Dim FN As String = myReader.GetString(1)
Dim exp As New Regex("^\d+_")
FN = exp.Replace(FN, "")
But thx for the snippet

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:uF**************@TK2MSFTNGP09.phx.gbl...
If the underscore is always the separator, the simplest method would be to
get the IndexOf("_") and the a substring based on that value.

something like

string newFilename = oldName.SubString(oldName.IndexOf("_") +1);

otherwise if your pattern is more complicated, you'll need to use a regular expression.

Karl

--

MY ASP.Net tutorials
http://www.openmymind.net/

"Patrick.O.Ige" <na********@hotmail.com> wrote in message
news:u4**************@TK2MSFTNGP15.phx.gbl...
I have a file below
16_vir24CE.log
How can i remove 16_ or 123_
I want to have "vir24CE.log" as my output file


Dec 1 '05 #3

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

Similar topics

2
by: D. Alvarado | last post by:
Hello, I have an array that contains numbers. Each element in the array is guaranteed to be unique. Let's say I have another variable which I know for certain is in the array, but I don't know...
5
by: Paradox | last post by:
In general I love Python for text manipulation but at our company we have the need to manipulate large text values stored in either a SQL Server database or text files. This data is stored in a...
1
by: ChrisC | last post by:
Im having trouble removing line breaks from my c# string. Actually, im having trouble getting .Trim() to work properly, as it seems to count a string that has nowt but a break of some sort as not...
4
by: Anthony | last post by:
Hi, Removing files seems to be rather clumsy in C (not C++). I am trying next piece of code to delete a file (under W32); int errno; errno = remove("FSelCancelled"); After exiting the...
23
by: Peter Row | last post by:
Hi, I am currently working on a VB.NET project that has been going for quite a while. In the past it has been developed with a lot of compatibility VB6 functions and constants, e.g Left(),...
6
by: bruce | last post by:
hi... i'm running into a problem where i'm seeing non-ascii chars in the parsing i'm doing. in looking through various docs, i can't find functions to remove/restrict strings to valid ascii...
4
by: JJ | last post by:
Is there a way of checking that a line with escape sequences in it, has no strings in it (apart from the escape sequences)? i.e. a line with \n\t\t\t\t\t\t\t\r\n would have no string in it a...
2
by: beatTheDevil | last post by:
Hey guys, As the title says I'm trying to make a regular expression (regex/regexp) for use in removing the comments from code. In this case, this particular regex is meant to match /* ... */...
11
by: ramu | last post by:
Hi, Suppose I have a string like this: "I have a string \"and a inner string\\\" I want to remove space in this string but not in the inner string" In the above string I have to remove...
13
by: Eps | last post by:
Hi there, I believe all strings in .net are unicode by default, I am looking for a way to remove all non ascii characters from a string (or optionally replace them). There is an article on...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.