Hi there,I know that trim return a string withount spacing if spacing is at the begining,but I need that Countru Type be returned as CountryType....How can I do this
3 3267
hi,
the following code can be written to solve that problem -
<script type="text/javascript">
-
function loadfuc()
-
{
-
var strTemp = "country Type";
-
alert(strTemp);
-
debugger
-
var strTemp = Trim(strTemp);
-
-
alert(strTemp);
-
-
}
-
-
function Trim(strTemp)
-
{
-
var string="",index1=0,index=0;
-
index=strTemp.indexOf(" ");
-
string=string+strTemp.substring(index1,index)+strTemp.substring(index+1,strTemp.length);;
-
return string;
-
}
-
-
-
</script>
-
-
-
Hi there,I know that trim return a string withount spacing if spacing is at the begining,but I need that Countru Type be returned as CountryType....How can I do this
hi
the above program only for one space like country Type but for an example country Type hai it doesnot work then check below code -
<script type="text/javascript">
-
function loadfuc()
-
{
-
var strTemp = "country Type hai";
-
alert(strTemp);
-
-
var strTemp = Trim(strTemp);
-
-
alert(strTemp);
-
-
}
-
-
function Trim(strTemp)
-
{
-
var string="",index1=0,index=0;
-
index=strTemp.indexOf(" ");
-
while(index!=-1)
-
{
-
string=string+strTemp.substring(0,index);
-
strTemp=strTemp.substring(index+1,strTemp.length);
-
index=strTemp.indexOf(" ");
-
}
-
-
-
string=string+strTemp.substring(index+1,strTemp.length);
-
-
return string;
-
}
-
-
-
</script>
-
-
-
-
-
-
-
-
hi,
the following code can be written to solve that problem -
<script type="text/javascript">
-
function loadfuc()
-
{
-
var strTemp = "country Type";
-
alert(strTemp);
-
debugger
-
var strTemp = Trim(strTemp);
-
-
alert(strTemp);
-
-
}
-
-
function Trim(strTemp)
-
{
-
var string="",index1=0,index=0;
-
index=strTemp.indexOf(" ");
-
string=string+strTemp.substring(index1,index)+strTemp.substring(index+1,strTemp.length);;
-
return string;
-
}
-
-
-
</script>
-
-
-
Hi there,I know that trim return a string withount spacing if spacing is at the begining,but I need that Countru Type be returned as CountryType....How can I do this
this may be easier for you
Replace("Country Type", " ", "")
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Simon |
last post by:
Hi,
I have written a function to trim char *, but I have been told that my way
could be dangerous and that I should use memmove(...) instead.
but I am not sure why my code could be 'dangerous'...
|
by: Durgesh Sharma |
last post by:
Hi All,
Pleas help me .I am a starter as far as C Language is concerned .
How can i Right Trim all the white spaces of a very long (2000 chars)
Charecter string ( from the Right Side ) ? or how...
|
by: Darren Anderson |
last post by:
I have a function that I've tried using in an if then statement and I've
found that no matter how much reworking I do with the code, the expected
result is incorrect.
the code:
If Not...
|
by: Pascal |
last post by:
bonjour hello
I would like to trim a string of all its white spaces so i used
myString.trim() but it doesn't work as supposed : unsecable space are
remaining in the middle of my string...
i...
|
by: rjoseph |
last post by:
Hi guys
I have a simple one for you.
I am currently using the following script to display data from my database field onto my page
-------------------------
<a...
|
by: FAQ server |
last post by:
-----------------------------------------------------------------------
FAQ Topic - How do I trim whitespace -
trim/trimRight/trimLeft...
|
by: swengineer001 |
last post by:
Just looking for a few eyes on this code other than my own.
void TrimCString(char *str)
{
// Trim whitespace from beginning:
size_t i = 0;
size_t j;
while(isspace(str))
{
|
by: Kevin Smith |
last post by:
Hi,
According to the intellisense help, string.Trim() "Removes all occurances
or white space characters from the beginning and end of this instance."
However, the follow code does not appear...
|
by: Peter Duniho |
last post by:
On Wed, 08 Oct 2008 11:26:01 -0700, Kevin Smith <no@spam.comwrote:
No, it wouldn't. Nor would it modify the String instance that s refers
to. Strings are immutable. They are _never_...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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$) {
}
...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
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...
| |