Hello all,
Would anyone please be able to help?
I would like to remove all characters after and including the @ from a
string, for example the string jo********@some place.com would become
Joe Bloggs.
Thanks You all,
Jon 5 91920
Jon wrote: I would like to remove all characters after and including the @ from a string,
myString = myString.replac e(/@.*/, "");
Or, compatible with very old script engines
var atpos = myString.indexO f("@");
if (atpos > -1) {
myString = myString.substr ing(0, atpos);
}
for example the string jo********@some place.com would become Joe Bloggs.
Did you mean "joe.Bloggs "?
ciao, dhgm
Jon wrote: Hello all,
Would anyone please be able to help?
I would like to remove all characters after and including the @ from a string, for example the string jo********@some place.com would become Joe Bloggs.
<script type="text/JavaScript">
var jb="jo********@ someplace.com". split("@")[0].replace(/\./," ")
jb=jb.charAt(0) .toUpperCase()+ jb.substring(1) ;
alert(jb);
</script>
Mick
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
</head>
<body>
<script type="text/javascript">
function user(addr)
{
return addr
.replace(/^(.+)@.*$/, '$1')
.replace(/\./g, ' ')
.replace(/\b./g, function(a){ret urn a.toUpperCase() ;})
}
document.write(
'<pre>' ,
user('j*******@ someplace.com') ,
'\n' ,
user('b******** ****@mydomain.a u') ,
'\n' ,
user('foo.Bar@h aha/vavoom.net') ,
'</pre>'
);
</script>
</body>
</html>
JRS: In article <bb************ **************@ posting.google. com>,
dated Wed, 27 Apr 2005 08:44:16, seen in news:comp.lang. javascript, Jon
<Jo*******@gmai l.com> posted : I would like to remove all characters after and including the @ from a string, for example the string jo********@some place.com would become Joe Bloggs.
S = "jo********@som eplace.com"
S = S.split('@')[0]
is another way.
S = "jo********@som eplace.com"
T = S.split('@') // T[0] & T[1] may be useful
--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.c om/faq/> JL/RC: FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Joseph |
last post by:
I have a textBox that people writes stories in it. They can use
for format.
I have Aspell installed on the server, so people can make correction to
their text. Sometimes, they forget to add a space after a period. So Aspell
reads the last word of a sentence and the first word of the next sentence as
a single world, which gives an error, word not found.
Before sending the text to Aspell, i add a space after all the periods with:
|
by: deko |
last post by:
I need to loop through a string and remove all characters except numbers or
letters. I am getting an ArgumentOutOfRangeException: "Index was out of
range. Must be non-negative and less than the size of the collection"
Not sure what is going on... any suggestions welcome!
public static string fixStr(string aStr)
{
StringBuilder bStr = new StringBuilder(aStr.Length);
for (int i = 0; i < aStr.Length; i++)
|
by: Paul |
last post by:
Hi,
My VB is very rusty I'm afraid! What would be the most efficient way to
remove the following ASCII characters from a string?
à è ì ò ù À È Ì Ò Ù
á é í ó ú ý Á É Í Ó Ú Ý
â ê î ô û Â Ê Î Ô Û
ã ñ õ Ã Ñ Õ
ä ë ï ö ü ÿ Ä Ë Ï Ö Ü Y o O æ Æ
|
by: morleyc |
last post by:
Hi, i would like to remove a number of characters from my string (\t
\r \n which are throughout the string), i know regex can do this but i
have no idea how. Any pointers much appreciated.
Chris
|
by: Smiley |
last post by:
Hi,
Can someone tell me how to remove aspostophe (') from user input.
I don't want to give any error message. Just want to remove or change it to
"" or null, such input when it appear anywhere on a specific field. e.g. if
user input abcd's. I want the final data on the database be look like abcds
or abcd s
MSAccess 2000
| |
by: cody |
last post by:
Is there a method to replace special characters like Ä (A-Umlaut) with
A, Ö (O-Umlaut) with O, and so on?
Sure, I could look for each character separately and replace it with its
ascii-counterpart, but there are also such special characters in French
and Swedish and many other languages which I also want to catch. Is
there a generic way to do it?
|
by: Konstantinos Pachopoulos |
last post by:
Hi,
i have the following string s and the following code, which doesn't
successfully remove the "\", but sucessfully removes the "\\".
.... if i!="\\":
.... newS=newS+i
....
'Sadasd\x07sd'
I have also read the following, but i do not understand the "...and the
|
by: Mike Copeland |
last post by:
I have data I need to normalize - it's "name" data. For example, I
have the following: "Watts, J.C." I wish to (1) parse the "first name"
("J.C.") and adjust it to "JC". Essentially, I want to remove the
punctuation characters from the "first name" substring.
I've looked at the basic_string in C++, but I can't find the
functions that will _remove" character(s) from a value. There are
operators that are helpful in finding the position...
|
by: Brad |
last post by:
I'm writing a function to remove certain characters from strings. For
example, I often get strings with commas... they look like this:
"12,384"
I'd like to take that string, remove the comma and return "12384"
What is the most efficient, fastest way to approach this?
Thanks,
|
by: MC |
last post by:
Is there a string function in .NET that will remove the accent marks from letters? I know that's a slightly vague request... and that I could implement it by table lookup (and will do so unless something's already there). But can it be accomplished by switching a string among "cultures" or something like that?
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |