473,406 Members | 2,356 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,406 software developers and data experts.

How to covert string to a new string

Dear all:
I develop a programe that need when I get a string , such as "123" or
"ABC",if I get string "123" and the system will help me to create new
string "124" , if I get string "ABC" and the system will help me to create
new string "ABD" , could somebody can help me how to programe it , thank you
very much.

I don't know to how to covert string as ASCII and add integer value and
covert the integer back to string, hope can support me the code I'll very
appricate, thanks.
Jul 12 '06 #1
6 3662
Calros,

If you want to add a number, then you can use the static ToInt32 method
on the Convert class to convert your string to an integer. Then, you can
just perform your arithmetic.

When you want to convert it back to a string, then you can call ToString
on the int variable.

As for incrementing a letter, you can create a character array and then
increment the character by one in the array.

However, you have to have logic for when you get to the letter Z.

Then you can convert the character array back to a string.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Calros Lo" <ca********@hotmail.comwrote in message
news:uY**************@TK2MSFTNGP05.phx.gbl...
Dear all:
I develop a programe that need when I get a string , such as "123" or
"ABC",if I get string "123" and the system will help me to create new
string "124" , if I get string "ABC" and the system will help me to create
new string "ABD" , could somebody can help me how to programe it , thank
you very much.

I don't know to how to covert string as ASCII and add integer value and
covert the integer back to string, hope can support me the code I'll very
appricate, thanks.

Jul 12 '06 #2

"Calros Lo" <ca********@hotmail.comwrote in message
news:uY**************@TK2MSFTNGP05.phx.gbl...
Dear all:
I develop a programe that need when I get a string , such as "123" or
"ABC",if I get string "123" and the system will help me to create new
string "124" , if I get string "ABC" and the system will help me to create
new string "ABD" , could somebody can help me how to programe it , thank
you very much.

I don't know to how to covert string as ASCII and add integer value and
covert the integer back to string, hope can support me the code I'll very
appricate, thanks.
What happens when "ABC" eventually becomes "ABZ"? Does the previous letters
get up'ed? Such as "ACA"? If so, what happens at "ZZZ"? Does it become
"AAAA" or "ZZZA"? Need more info if we are to help :)

Mythran

Jul 12 '06 #3
Hi~
Thank for you point my problem, I consider that If I get the string of end
letter is"Z" I'll take ignore, in other word If I get string "ABZ" than keep
the string orginal "ABZ" or not do anything.

I just want to know how If I get "123" than get "124" thanks everybody, I
will appreaciate.

"Mythran" <ki********@hotmail.comREMOVETRAILwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
>
"Calros Lo" <ca********@hotmail.comwrote in message
news:uY**************@TK2MSFTNGP05.phx.gbl...
>Dear all:
I develop a programe that need when I get a string , such as "123" or
"ABC",if I get string "123" and the system will help me to create new
string "124" , if I get string "ABC" and the system will help me to
create new string "ABD" , could somebody can help me how to programe it ,
thank you very much.

I don't know to how to covert string as ASCII and add integer value and
covert the integer back to string, hope can support me the code I'll very
appricate, thanks.

What happens when "ABC" eventually becomes "ABZ"? Does the previous
letters get up'ed? Such as "ACA"? If so, what happens at "ZZZ"? Does it
become "AAAA" or "ZZZA"? Need more info if we are to help :)

Mythran

Jul 12 '06 #4
Calros Lo wrote:
Dear all:
I develop a programe that need when I get a string , such as "123" or
"ABC",if I get string "123" and the system will help me to create new
string "124" , if I get string "ABC" and the system will help me to create
new string "ABD" , could somebody can help me how to programe it , thank you
very much.

I don't know to how to covert string as ASCII and add integer value and
covert the integer back to string, hope can support me the code I'll very
appricate, thanks.

string s = "abc";
char subChar = s[2]; // last character
subChar++;
Console.WriteLine(s.Substring(0,2) + subChar);

HTH

JB
Jul 13 '06 #5
Hi Mythran
Can you point me , If I get string "ABZ" do you have any solution , if I
get it.
I think If I get string "ABZ" I want convert it as "ABZA" can you help me to
programe
how to write it, thank you very much.

"Mythran" <ki********@hotmail.comREMOVETRAILwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
>
"Calros Lo" <ca********@hotmail.comwrote in message
news:uY**************@TK2MSFTNGP05.phx.gbl...
>Dear all:
I develop a programe that need when I get a string , such as "123" or
"ABC",if I get string "123" and the system will help me to create new
string "124" , if I get string "ABC" and the system will help me to
create new string "ABD" , could somebody can help me how to programe it ,
thank you very much.

I don't know to how to covert string as ASCII and add integer value and
covert the integer back to string, hope can support me the code I'll very
appricate, thanks.

What happens when "ABC" eventually becomes "ABZ"? Does the previous
letters get up'ed? Such as "ACA"? If so, what happens at "ZZZ"? Does it
become "AAAA" or "ZZZA"? Need more info if we are to help :)

Mythran

Jul 13 '06 #6
Hi,
"Calros_Lo" <ca********@hotmail.comwrote in message
news:OD**************@TK2MSFTNGP03.phx.gbl...
Hi Mythran
Can you point me , If I get string "ABZ" do you have any solution , if I
get it.
I think If I get string "ABZ" I want convert it as "ABZA" can you help me
to programe
Well if you do not know what to do in that case maybe you want to rethink
the entire thing over :)

Start with thinking why are you doing it and what you want from it.

Un Saludo,

--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Jul 13 '06 #7

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

Similar topics

3
by: Cindy Liu | last post by:
Hi Everyone, In .Net we have XmlSerializer to convert c# class to xml, or vice versa. Do we have any APIs to convert c# class to XSD? Thanks in advance, Cindy
13
by: Ray Z | last post by:
So far, I get the idea that if I want to use both the unmanaged and managed memory, I can not avoid memory copy. But I DO need to avoid it. I get a idea that maybe I could use "union" to convert...
3
by: Karunakararao | last post by:
Hi ALL this string object usi.RequestFilterRequestFromDate iam doing like this But it is giving error - "String was not recognized as a valid DateTime." strDate...
6
by: CarlEOgden | last post by:
Hi, I've found this example but when I try to rework it for VB.Net I fail with the API calls and the CopyMemory procedure and to be truthful, it's far over my skill level with the getting...
3
by: henk | last post by:
i have a utc string how can i convert it to utc datetime? is this ok: dim UtcDate as Datetime=Datetime.parse(UtcString)?
4
by: Jim Florence | last post by:
Hello, I've just started in ASP and I'm having a few teething problems. Initially I tried to write out dates from the database using <asp:Label runat="server" ID="Label6" Text='<%#...
21
by: Wisdo | last post by:
Hi All, char to char ** is compile error. why? if i hava a string array. yes. it's not safe and it's better to use vector<stringinstead. but my point is the language feature. char...
6
by: =?Utf-8?B?dmluY2VudA==?= | last post by:
Is there any method to covert a pdf file into jpg file in c#? Many thanks for your replying.
1
by: jonny | last post by:
Option Explicit Private mdTarget1 As Date Private mdTarget2 As Date ' called on form load Public Sub SetRecordStartTime() mdTarget1 = DateAdd("n", 60, Time) mdTarget2 = DateAdd("n", 120,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
0
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,...
0
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...
0
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...

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.