Jump to content
php.lv forumi

Recommended Posts

Posted

vispirms jautāsim kā tu to domā?

vai tieši tekstā ir lielie burti vai arī ja ir ieslēgts CAPS LOCK taustiņš vai vēl kāds cits variants.

Posted (edited)

Līdzīga problēma ir aprakstīta šeit: links

 

tur izlīdzējās ar ereg("[A-Z]", ....) funkciju.

 

vēl te viens piemērs:

 

$test1 = "This started with a capital";
$test2 = "this one not";
testCapital($test1);
testCapital($test2);

function testCapital($aStr)
{
 $firstChar = substr($aStr,0,1);
 if ($firstChar == mb_strtoupper($firstChar))
 {
 echo "<br>'".$aStr."' starts with a capital.";
 } 
 else 
 {
 echo "<br>'".$aStr."' starts NOT with a capital.";
 } 
}

 

 

paartaisi to savaam vajadziibaam un buus ok ;)

Edited by darksign
Posted

Piemeram tiek ievadits: dAivEd

Raada erroru: Nelietojiet lielos burtus!

VAI

Raada ka lielie burti ir: AE, vai arii atbild ar TRUE un FALSE, TRUE(Ir satura lielais burts) False(nav)

Posted

..
$firstChar = substr($aStr,0,1);
if ($firstChar == mb_strtoupper($firstChar))
..

 

kāda jēga no mb_strtoupper(), ja pirmo burtu ar 'parasto' substr()?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...