C++:
[codes=html]
char buffer[1024],buffer2[1024];
strcpy(buffer,row[0]);
char* p = strstr(buffer,"@");
*p=0;
cout <<buffer<<"\t";
[/codes]
Js实现前两位为**:
[code]<script langrage="javascript">
var str='372647693';
str = "**"+str.substr(2);
alert(str);
</script>[/code]
输出:**2647693
Js实现后两位为**:
[code]<script langrage="javascript">
var str='372647693';
var len=str.length;
str =str.substr(0,len-2)+ "**";
alert(str);
</script>[/code]输出:3726476**
如果是整形,需要转换为string:
[code]<script langrage="javascript">
var str=372647693;
str='**'+str.toString().substr(2);
alert(str);
</script>[/code]
如果是string,需要转换为整形:
fileNum = parseInt(fileNum);
如果是string,需要转换为浮点形:
fileNum = parseFloat(fileNum);
解决JS浮点数(小数)计算加减乘除的BUG:
http://www.cnblogs.com/binjoo/archive/2012/09/10/2679151.html
[codes=html]
char buffer[1024],buffer2[1024];
strcpy(buffer,row[0]);
char* p = strstr(buffer,"@");
*p=0;
cout <<buffer<<"\t";
[/codes]
Js实现前两位为**:
[code]<script langrage="javascript">
var str='372647693';
str = "**"+str.substr(2);
alert(str);
</script>[/code]
输出:**2647693
Js实现后两位为**:
[code]<script langrage="javascript">
var str='372647693';
var len=str.length;
str =str.substr(0,len-2)+ "**";
alert(str);
</script>[/code]输出:3726476**
如果是整形,需要转换为string:
[code]<script langrage="javascript">
var str=372647693;
str='**'+str.toString().substr(2);
alert(str);
</script>[/code]
如果是string,需要转换为整形:
fileNum = parseInt(fileNum);
如果是string,需要转换为浮点形:
fileNum = parseFloat(fileNum);
解决JS浮点数(小数)计算加减乘除的BUG:
http://www.cnblogs.com/binjoo/archive/2012/09/10/2679151.html
作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:https://jackxiang.com/post/934/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!
最后编辑: jackxiang 编辑于2015-5-12 10:46
评论列表