473,725 Members | 1,816 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Replace, Left, Right functions in C#

Hi,

Does C# has functions such as replace, left, right, substring for strings?
Without these functions, it's not easy to process strings.

TIA
Jan 19 '06 #1
3 6464
Me
The String class has those methods.

Ex.)

String a = "hello";
a.Substring();
a.Remove();
a.Trim();
a.TrimEnd();
a.TrimStart();
a.ToUpper();

You get the idea.
"Ed Chiu" <Ed****@discuss ions.microsoft. com> wrote in message
news:76******** *************** ***********@mic rosoft.com...
Hi,

Does C# has functions such as replace, left, right, substring for strings?
Without these functions, it's not easy to process strings.

TIA

Jan 19 '06 #2
Here is a link to the MSDN documentation for the String class:

http://msdn.microsoft.com/library/de...classtopic.asp

Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Ed Chiu" wrote:
Hi,

Does C# has functions such as replace, left, right, substring for strings?
Without these functions, it's not easy to process strings.

TIA

Jan 19 '06 #3
On Thu, 19 Jan 2006 13:06:16 -0500, "Me" <me@home.com> wrote:
The String class has those methods.

Ex.)

String a = "hello";
a.Substring( );
a.Remove();
a.Trim();
a.TrimEnd();
a.TrimStart( );
a.ToUpper();

Plus
if(a.StartsWith ("he"))
{
// dosomthing
}
etc...
a.EndsWith("lo" );
Otis Mukinfus
http://www.otismukinfus.com
http://www.tomchilders.com
Jan 19 '06 #4

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

Similar topics

17
47817
by: Pikkel | last post by:
i'm looking for a way to replace special characters with characters without accents, cedilles, etc.
2
12822
by: Ermi | last post by:
Hi, i have this problem.... From a visual basic application I must replace the value contained in a column with another one....for example Field1 ------ Alfa Beta Gamma
22
2866
by: Michael Nahas | last post by:
Antti & all interested, The draft description of my language to replace C is available at: http://nahas.is-a-geek.com/~mike/MyC.pdf I am a long time C programmer (I read the old testament in 1987) and I've tried to keep the spirit of C and make as few changes as possible. I was mostly driven by the bloat of C++ and, now, C99. I was also
2
13861
by: cloudx | last post by:
Hi there, Here is the line of VB code and I would like to translate into C#, please help! Thanks! sMsgIntHeader = (Replace(Replace(Trim(Left(sErrorMsg, InStr(5, sErrorMsg, vbCrLf))), vbLf, ""), vbCr, ""))
11
5112
by: Bruce A. Julseth | last post by:
I have: If (Microsoft.VisualBasic.Left(TextBox1.Text, 1) = "$") Then TextBox1.Text = Microsoft.VisualBasic.Right(TextBox1.Text, TextBox1.Text.Length - 1) End If Adding: Imports Microsoft.VisualBasic
19
3603
by: gk245 | last post by:
I have something like this: printf("Enter numbers: "); scanf ("%i", &number); If the user put in a bunch of numbers (like 4568), instead of just one number, i know that you can extract the right most digit with this: right_number = number % 10; /* print the number */
9
58230
by: sql guy123 | last post by:
I normally use MS ACCESS vs MS SQL,, which has a left() and right() function. I need to use MS SQL for this project but I am not familiar with it. I have read a few books, but can not figure out how to do this. Please help. If I need to compare the first 4 letters of a field, with the first four letters of another field, how can I do this? Select field1, field2 FROM table1 Where left(field1,4)=left(field2,4)
52
6333
by: MP | last post by:
Hi trying to begin to learn database using vb6, ado/adox, mdb format, sql (not using access...just mdb format via ado) i need to group the values of multiple fields - get their possible variations(combination of fields), - then act on each group in some way ...eg ProcessRs (oRs as RecordSet)... the following query will get me the distinct groups
16
3595
Scott Price
by: Scott Price | last post by:
Hello again good folks! MS Access 2003, WinXP SP2 This time I'm having a trouble with the logic required to search a text box for one of three particular strings ("degrees", "degree" and/or "deg") and replace it with Chr(176), which is the ANSI degree symbol... I've got a rather convoluted select case, nested if... then, nested do until ... loop structure which results in an endless loop/crashed program. (my test statement has been "Cook...
0
8751
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
9401
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
9108
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8093
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, 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...
1
6702
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
6010
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();...
0
4781
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3218
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
3
2155
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.