首页 > 软件资讯 > 正文

js首字母大写,js正则判断一个字符串里必须包含大写字母,小写字母,数字,特殊字符? 必须包含其中三项,求教

2020-04-30 09:41:28  来源:http://www.yummyboobs.net  编辑:admin

设计函数实现将一个字符串中小写字母转化为大写字母。

char A-a(char st){ st = st - 32; return st;} 在主函数里可以将小写转换成大写的,如 a = A-a(a);

PHP 中文转拼音并首字母大写

<?phpfunctiongetfirstchar($s0){$fchar=ord($s0{0});if($fchar>=ord("A")and$fchar<=ord("z"))returnstrtoupper($s0{0});$s1=iconv("UTF-8","gb2312",$s0);$s2=iconv("gb2312","UTF-8",$s1);if($s2==$s0){$s=$s1;}else{$s=$s0;}$asc=ord($s{0})*256+ord($s{1})-65536;if($asc>=-20319and$asc<=-20284)return"A";if($asc>=-20283and$asc<=-19776)return"B";if($asc>=-19775and$asc<=-19219)return"C";if($asc>=-19218and$asc<=-18711)return"D";if($asc>=-18710and$asc<=-18527)return"E";if($asc>=-18526and$asc<=-18240)return"F";if($asc>=-18239and$asc<=-17923)return"G";if($asc>=-17922and$asc<=-17418)return"H";if($asc>=-17417and$asc<=-16475)return"J";if($asc>=-16474and$asc<=-16213)return"K";if($asc>=-16212and$asc<=-15641)return"L";if($asc>=-15640and$asc<=-15166)return"M";if($asc>=-15165and$asc<=-14923)return"N";if($asc>=-14922and$asc<=-14915)return"O";if($asc>=-14914and$asc<=-14631)return"P";if($asc>=-14630and$asc<=-14150)return"Q";if($asc>=-14149and$asc<=-14091)return"R";if($asc>=-14090and$asc<=-13319)return"S";if($asc>=-13318and$asc<=-12839)return"T";if($asc>=-12838and$asc<=-12557)return"W";if($asc>=-12556and$asc<=-11848)return"X";if($asc>=-11847and$asc<=-11056)return"Y";if($asc>=-11055and$asc<=-10247)return"Z";returnnull;}functionmake_semiangle($str){$arr=array('0'=>'0','1'=>'1','2'=>'2','3'=>'3','4'=>'4','5'=>'5','6'=>'6','7'=>'7','8'=>'8','9'=>'9','A'=>'A','B'=>'B','C'=>'C','D'=>'D','E'=>'E','F'=>'F','G'=>'G','H'=>'H','I'=>'I','J'=>'J','K'=>'K','L'=>'L','M'=>'M','N'=>'N','O'=>'O','P'=>'P','Q'=>'Q','R'=>'R','S'=>'S','T'=>'T','U'=>'U','V'=>'V','W'=>'W','X'=>'X','Y'=>'Y','Z'=>'Z','a'=>'a','b'=>'b','c'=>'c','d'=>'d','e'=>'e','f'=>'f','g'=>'g','h'=>'h','i'=>'i','j'=>'j','k'=>'k','l'=>'l','m'=>'m','n'=>'n','o'=>'o','p'=>'p','q'=>'q','r'=>'r','s'=>'s','t'=>'t','u'=>'u','v'=>'v','w'=>'w','x'=>'x','y'=>'y','z'=>'z','('=>'(',')'=>')','〔'=>'[','〕'=>']','【'=>'[','】'=>']','〖'=>'[','〗'=>']','“'=>'"','”'=>'"','‘'=>'\'','’'=>'\'','{'=>'{','}e79fa5e98193e58685e5aeb931333337616633'=>'}','《'=>'<','》'=>'>','%'=>'%','+'=>'+','—'=>'-','-'=>'-','~'=>'-',':'=>':','。'=>'.','、'=>',',','=>',',';'=>';','?'=>'?','!'=>'!','…'=>'...','‖'=>'|','|'=>'|','〃'=>'"',''=>'');returnstrtr($str,$arr);}functionpinyin1($zh){$zh=make_semiangle($zh);$ret="";$s1=iconv("UTF-8","gb2312",$zh);$s2=iconv("gb2312","UTF-8",$s1);if($s2==$zh){$zh=$s1;}for($i=0;$i<strlen($zh);$i++){$s1=substr($zh,$i,1);$p=ord($s1);if($p>160){$s2=substr($zh,$i++,2);$ret.=getfirstchar($s2);}else{$ret.=$s1;}}return$ret;}//用法echopinyin1('中文获取首字母大写,‘支持’全角“的”转化!');?>数字跟英文的全角被百度自动转了,如果需要下载附件源码

javascript怎么使用字符串函数进行首字母大写

var str= "feiyongshenqing";str = str.substring(0,1).toUpperCase()+str.substring(1);截取第一个位置变成大写,然知后从第道一个位置截取所有。

chjcszgbjs,kshsbkn,都是首字母,求翻译

车接车送这个不就是 我不知道这个是不是你要的答案,你可以追问哈~我可以帮你再想想哈~O(∩_∩)O。。。。。

数据库oracle(plsql)怎么把汉字转化成拼音首字母,如果非汉字字符 (英文or数字),返回原字符不变

CREATE OR REPLACE FUNCTION "FUN_GET_QUERYCODE"(v_string in varchar2,v_spellFlag in number)return varchar2 is/*-------------------------------------------------------------------------|| 函数名称 :转换成拼音码或者五笔码|| 功能描述 :将传入的字符串转换成相应的拼音码或者五笔码|||| 参数描述 :参数标识 输入/输出 类型 名称|| -------------------------------------------------------------|| v_string 输入 varchar2 需要转换的字符串|| v_type 输入 number 转换类型-0 转换成五笔码,1 (或7a6431333431356633其他)转换成拼音码,|| 返回: 字符型 转换后的查询码,如果出错误返回''||-------------------------------------------------------------------------*/I number(5);li_sqlcode number;li_count number;ls_sqlerrm varchar2(128);Ls_ReturnStr varchar2(50);Ls_ch varchar2(10);Ls_temp varchar2(10);begin--如果传入字符串为空,则返回空值if v_string is null thenreturn v_string;end if;ls_ReturnStr := '';I := 1;li_count := Length(substr(v_string, 1, 30));--依次处理v_string中每个字符For i in 1 .. li_count loopls_ch := substr(v_string, i, 1);--If ASCII(ls_ch)<128 then-- 非汉字 ,不变--ls_returnStr := ls_returnStr || upper(ls_ch);--Else-- 是汉字beginif v_spellFlag = 0 then--查询五笔码SELECT WB_CODEINTO Ls_tempFROM C_SPELLBASEWHERE NAME = ls_chAND ROWNUM = 1;else--查询拼音码SELECT PY_CODEINTO Ls_tempFROM C_SPELLBASEWHERE NAME = ls_chAND ROWNUM = 1;end if;--返回的字符串ls_returnStr := ls_returnStr || ls_temp;EXCEPTIONWHEN NO_DATA_FOUND THENls_returnStr := ls_returnStr;WHEN OTHERS THENli_sqlcode := sqlcode;ls_sqlerrm := substr(sqlerrm, 1, 128);return '';end;---end if ;end loop;--返回return substr(ls_returnStr, 1, 30);end fun_get_querycode;