I have a string that looks like this?
ihelloworld_zzz _yyy
In a single vb.net line, I want to remove the frist character and
anything after and including the first "_"
resulting in :
helloworld
I've been trying things like this:
Dim cleanname = c.ID.Remove(1). Substring(0, c.ID.IndexOf("_ "c))
Dim cleanname = c.ID.subsrting( 1,c.id.Length). Substring(0,
c.ID.IndexOf("_ "c))
the error I get is that the index is out of bounds becasue it's a
substring of a substring and the index I guess has changed.
thanks. 4 5367
Jason,
Without testing,
myNewString as string = "ihelloworld_zz z_yyy".Substrin g(1,10)
I hope this goes,
Cor
>
In a single vb.net line, I want to remove the frist character and
anything after and including the first "_"
resulting in :
helloworld
I've been trying things like this:
Dim cleanname = c.ID.Remove(1). Substring(0, c.ID.IndexOf("_ "c))
Dim cleanname = c.ID.subsrting( 1,c.id.Length). Substring(0,
c.ID.IndexOf("_ "c))
the error I get is that the index is out of bounds becasue it's a
substring of a substring and the index I guess has changed.
thanks.
sorry, the helloworld string is an example and might be longer or
shorter.
Cor Ligthert [MVP] wrote:
Jason,
Without testing,
myNewString as string = "ihelloworld_zz z_yyy".Substrin g(1,10)
I hope this goes,
Cor
In a single vb.net line, I want to remove the frist character and
anything after and including the first "_"
resulting in :
helloworld
I've been trying things like this:
Dim cleanname = c.ID.Remove(1). Substring(0, c.ID.IndexOf("_ "c))
Dim cleanname = c.ID.subsrting( 1,c.id.Length). Substring(0,
c.ID.IndexOf("_ "c))
the error I get is that the index is out of bounds becasue it's a
substring of a substring and the index I guess has changed.
thanks.
Try:
Dim str As String = "ihelloworld_zz z_yyy"
str = str.Substring(1 , str.IndexOf("_" ) - 1)
Thanks,
Seth Rowe
Jason wrote:
sorry, the helloworld string is an example and might be longer or
shorter.
Cor Ligthert [MVP] wrote:
Jason,
Without testing,
myNewString as string = "ihelloworld_zz z_yyy".Substrin g(1,10)
I hope this goes,
Cor
>
In a single vb.net line, I want to remove the frist character and
anything after and including the first "_"
>
resulting in :
>
helloworld
>
I've been trying things like this:
>
Dim cleanname = c.ID.Remove(1). Substring(0, c.ID.IndexOf("_ "c))
>
Dim cleanname = c.ID.subsrting( 1,c.id.Length). Substring(0,
c.ID.IndexOf("_ "c))
>
the error I get is that the index is out of bounds becasue it's a
substring of a substring and the index I guess has changed.
>
thanks.
>
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Garfield |
last post by:
Hello
I have a function that returns a string array. The string has a name and an ID number, they are separated by a comma.
I cannot for the life of me by using the string methods get to separate the two items.
Example.
The string array looks like, the array is called Trainee :-
Joe Bloggs,5678
|
by: Chad Myers |
last post by:
I've been perf testing an application of mine and I've noticed that there
are a lot (and I mean A LOT -- megabytes and megabytes of 'em) System.String
instances being created.
I've done some analysis and I'm led to believe (but can't yet quantitatively
establish as fact) that the two basic culprits are a lot of calls to:
1.) if( someString.ToLower() == "somestring" )
and
|
by: Tubs |
last post by:
Am i missing something or does the .Net Framework have a quirk in the
way methods work on an object. In C++ MFC, if i have a CString and i
use the format method, i format the string i am using. In dotnet it
always asks me to pass it the string. Why can't i just say
"stringvariable.Format("0.00") and have it know what i mean. Is there
a way to achieve this? What am i doing wrong
|
by: Dadox |
last post by:
Hi!
If I enter a name in textbox ("John Doe") for example,
how do I remove "John" If I click on command button to do so.
The point is to cut off first name and save it to array so only a last name
stays in textbox.
tnx
|
by: Roshawn |
last post by:
Hi,
I am retrieving a list of book titles from a web service. What I'd like to
do is shorten the titles, if possible. For example, there is a book titled
"Malicious Mobile Code: Virus Protection for Windows". It would be nice if
I could trim the title down to the colon (it would just say Malicious Mobile
Code).
Is there an easy way to accomplish this task?
| |
by: Darren Anderson |
last post by:
I have a function that I've tried using in an if then statement and I've
found that no matter how much reworking I do with the code, the expected
result is incorrect.
the code:
If Not (strIn.Substring(410, 10).Trim = "") Then
'Something processed
Else
'Something processed
|
by: klineb |
last post by:
Good Day,
I have written and utility to convert our DOS COBOL data files to a SQL
Server database. Part of the process requires parsing each line into a
sql statement and validting the data to keep the integrity of the
database. We are parsing roughl 81 files and range in size 1 kb to 65
MB files (Average of 400,000 lines in the larger files).
I have written this utility with VB.NET 2003 and when I parse all of
the files I run out...
|
by: Richard S |
last post by:
CODE: ASP.NET with C#
DATABASE: ACCES
alright, im having a problem, probably a small thing, but i cant figure out, nor find it in any other post, or on the internet realy (probably cuz i wouldnt know what to search for), but heres the problem:
I am making a search function for my website, i want this to be possible:
- search for 1 keyword (the problem guy)
- search for multiple keywords
things that alreaddy work (so no problem with...
|
by: =?Utf-8?B?QnJpYW4gQ29vaw==?= |
last post by:
This is an example of the data;
2007/07/27 11:00:03 ARES_INDICATION 010.050.016.002 404.2.01 (6511)
RX 74 bytes
2007/07/27 11:00:03 65 11 26 02 BC 6C AA 20 76 93 51 53 50 76 13
48
2007/07/27 11:00:03 52 00 52 02 02 C7 83 D7 07 07 1B 0B 00 00 00
00
2007/07/27 11:00:03 28 0A 06 06 06 06 06 06 06 06 06 06 06 0A 06
06
|
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,...
|
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...
| |
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,...
|
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: 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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| | |