473,379 Members | 1,539 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,379 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 1637
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...
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...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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
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?

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.