473,406 Members | 2,371 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,406 software developers and data experts.

space in username

exoskeleton
104 100+
hi guys...please help how to test if username contains spaces!

for example: "ric hard" = will be invalid!

supposed to be "richard"

TIA... :)
Apr 16 '07 #1
6 2541
exoskeleton
104 100+
anyone please help...i just wanna up this question! thank you
Apr 18 '07 #2
Deejam
13
hi,

hope this piece of code helps, change to your requirement :

Expand|Select|Wrap|Line Numbers
  1. $mystring = 'ric hard';
  2. $findme   = ' ';
  3. $pos = strpos($mystring, $findme);
  4. // Note our use of ===.  Simply == would not work as expected
  5. // because the position of 'a' was the 0th (first) character.
  6. if ($pos === false) {
  7.     echo "The string '$findme' was not found in the string '$mystring'";
  8. } else {
  9.     echo "The string '$findme' was found in the string '$mystring'";
  10.     echo " and exists at position $pos";
  11. }
  12.  
this code help to find the character existence...

Source : www.php.net
Apr 18 '07 #3
devsusen
136 100+
u can use -

[PHP] preg_match('/\s/', $UserName)[/PHP]

it will return FALSE if no space found.

susen
Apr 18 '07 #4
exoskeleton
104 100+
u can use -

[PHP] preg_match('/\s/', $UserName)[/PHP]

it will return FALSE if no space found.

susen
hi sir devsusen...how can i add more characters in preg_match to find?

thank you
Apr 19 '07 #5
exoskeleton
104 100+
hi,

hope this piece of code helps, change to your requirement :

this code help to find the character existence...

Source : www.php.net
thank you sir Deejam...
Apr 19 '07 #6
Deejam
13
you can add character between the quotes...


[PHP]preg_match('abcdef', $UserName)[/PHP]


Download the php manual, which helps alot

http://www.php.net/download-docs.php
Apr 19 '07 #7

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

Similar topics

13
by: dogu | last post by:
Noob alert. Code is below. File is saved as a .php. What I'm trying to do: User uses 'select' box drop down list to pick a value. Value ($site) is derived from a db query. This works fine....
11
by: Ghazan Haider | last post by:
I am posting this for the lack of a better newsgroup, and for the knowledge of people here, and because its only partially OT. We have a bunch of users with their computers at work. There are...
6
by: Ruaidhri | last post by:
I have a database that has grown larger than I had expected. I think there is one table that is at the root of the problem. The table is defined as follows: CREATE TABLE . ( IDENTITY (1, 1)...
3
by: Lamont | last post by:
VB.NET Can anyone tell me how I can get the Drive Space information from a remote computer on the same domain and physical network? Primarily I need the Total disk space and space used or free...
14
by: Brent Burkart | last post by:
I am trying to capture the Windows Authenticated username, but I want to be able to capture the login name that exists in IIS, not Windows. In order to enter my company's intranet through the...
0
by: roamnet | last post by:
hi i created database file with .mdf extention ,sql server as a source and use grid view to display data there're no problem in data retrieve and display,but i want to edit it or insert new...
0
by: fyitang | last post by:
On Mar 18, 1:04 am, "Henning Krause " <newsgroups_rem...@this.infinitec.dewrote: thanks Henning. i have tried this one <"test test@gmail.com">, and this worked. thank you.
2
by: shapper | last post by:
Hello, I know that only authenticated users has a UserName. In Anonymous users there is an ID. If I am not wrong when getting a profile of a user, if the user is authenticated the UserName is...
2
by: ArizonaJohn | last post by:
Hello, Below I have some Ajax and the page it points to. This code works great if $_SESSION has no spaces in it (for example, if it is "elpaso"). However, if $_SESSION has a space in it (for...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
tracyyun
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...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.