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

Replace a letter in a string

Suppose that you have a string e.g. "delicious" and an integer e.g. 5. How
to
replace the character at position 5 with next character (in position 6) so
that "delicious" becomes "deliicous" ?

Nov 20 '05 #1
4 1634
NM
I suggest that :

Dim myWord As String = "delicious"

Dim myWordInChar As Char() = myWord.ToCharArray()

Dim tmp As Char = myWordInChar(4)

myWordInChar(4) = myWordInChar(5)

myWordInChar(5) = tmp

myWord = New String(myWordInChar)

"Dinko Deranja" <dd******@public.srce.hr> a écrit dans le message de
news:%2****************@tk2msftngp13.phx.gbl...
Suppose that you have a string e.g. "delicious" and an integer e.g. 5. How
to
replace the character at position 5 with next character (in position 6) so
that "delicious" becomes "deliicous" ?

Nov 20 '05 #2
NM
I suggest that :

Dim myWord As String = "delicious"

Dim myWordInChar As Char() = myWord.ToCharArray()

Dim tmp As Char = myWordInChar(4)

myWordInChar(4) = myWordInChar(5)

myWordInChar(5) = tmp

myWord = New String(myWordInChar)

"Dinko Deranja" <dd******@public.srce.hr> a écrit dans le message de
news:%2****************@tk2msftngp13.phx.gbl...
Suppose that you have a string e.g. "delicious" and an integer e.g. 5. How
to
replace the character at position 5 with next character (in position 6) so
that "delicious" becomes "deliicous" ?

Nov 20 '05 #3
Cor
I go for

dim a as string = "delicious"
dim b as string = a.substring(0,4) & a.substring(3)

Cor
Suppose that you have a string e.g. "delicious" and an integer e.g. 5. How
to
replace the character at position 5 with next character (in position 6) so
that "delicious" becomes "deliicous" ?

Nov 20 '05 #4
Cor
I go for

dim a as string = "delicious"
dim b as string = a.substring(0,4) & a.substring(3)

Cor
Suppose that you have a string e.g. "delicious" and an integer e.g. 5. How
to
replace the character at position 5 with next character (in position 6) so
that "delicious" becomes "deliicous" ?

Nov 20 '05 #5

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

Similar topics

14
by: Nicolas Bouillon | last post by:
Hi I would like to replace accentuel chars (like "é", "è" or "à") with non accetued ones ("é" -> "e", "è" -> "e", "à" -> "a"). I have tried string.replace method, but it seems dislike...
3
by: Claude Schneegans | last post by:
Hi, I'trying to use a regExp in Javascript to replace any all upper case word in a string by the same word having only its first letter in upper case. This expression detects the words: /()(+)/g...
22
by: Phlip | last post by:
C++ers: Here's an open ended STL question. What's the smarmiest most templated way to use <string>, <algorithms> etc. to turn this: " able search baker search charlie " into this: " able...
3
by: Raed Sawalha | last post by:
I have the following letters; string letters = "a;b;c....to z"; the I need to replace the incoming string which containing letters above with integer 1 i did following for(int...
4
by: jgabbai | last post by:
Hi, What is the best way to white list a set of allowable characters using regex or replace? I understand it is safer to whitelist than to blacklist, but am not sure how to go about it. Many...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.