473,471 Members | 1,912 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to replace a specidfic character in a phrase

2 New Member
I want to replace the 3 last characters of file, just before the dot in extension.

I know there is a command to do it but i just can't fine it.

I want it to go like this

Expand|Select|Wrap|Line Numbers
  1.  
  2. Var file = self.location.toString();
  3. Var MyVar= ( 3 last characters before extension)
  4.  
  5.  
  6.    If MyVar="_en" replace with "_gr"
  7.  
  8.            else replace with "_en"
  9.  
  10.    end if
  11.  
  12.  
To give you an idea of what i'm trying to do,
In the end i want it to be able to replace "SomePage_en" with "Somepage_gr" and the opposite
Excuse my ignorance in Java but i just started using it today.
May 8 '10 #1
1 1675
jkmyoung
2,057 Recognized Expert Top Contributor
Sorry, are you trying to rename a file, or edit a file's contents?
If the former, look at the File.renameTo function.
http://java.sun.com/javase/6/docs/ap...(java.io.File)
May 10 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Venkat | last post by:
Greetings, I got a string like this str = {1234-4543-6453-ACBD-AFEB} now i need to have an output like str = 1234-4543-6453-ACBD-AFEB, basically i want to remove the characters '{' and '}'. ...
1
by: GlennH | last post by:
I am having trouble removing a pipe character using Regex.Replace - see the 2 NUnit tests below: The first replace works fine and the second Replace does not work. I've tried escaping the pipe...
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...
5
by: Kay | last post by:
Hi All, I'm trying to write a small sub/function to replace some (invalid) character in a combo box, or may be even text box. For example, I have several combo boxes that allows user to select...
5
by: Martin Kulas | last post by:
Hello! How do I replace a single character in a string at a given position? From programming languages like C I expect something like that: Traceback (most recent call last): File...
5
by: xla76 | last post by:
Can anyone help me, I'm trying to replace any double quotes in a textbox with a different character. mystring = Replace(TextBox.Text , " , "*") I've tried chr(34) and """"" with no luck. ...
1
by: Bostonian | last post by:
Hello, In an XML How do i replace the escape character "\" with "" ? I tried few differently things in C# like Replace, nothing seems to work. Example : <Veh id=\"Vehicle-01\" > I want to...
3
by: GoalieDude | last post by:
My problem is that I'll receive a large excel file from a customer that has hard return in one of the cells (i.e. pressing alt + enter to make a new line in a cell) and when I export it to a text...
3
by: dillipkumar | last post by:
Can somebody help me, Take any string from command line prompt & replace what ever special character will get in that string that should be replaced with \ character. Ex: Enter any string:...
2
n8kindt
by: n8kindt | last post by:
hey guys, i have a function that can recognize a space character in a string... how can i get it to replace a space with a underscore character Public Function RemoveSpaces(strInput As String) '...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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,...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.