GVKun编程网logo

SQL Server format phone number

1

对于SQLServerformatphonenumber感兴趣的读者,本文将提供您所需要的所有信息,并且为您提供关于.NETString.Format()在数千个数字中添加逗号-.NETString.

对于SQL Server format phone number感兴趣的读者,本文将提供您所需要的所有信息,并且为您提供关于.NET String.Format()在数千个数字中添加逗号 - .NET String.Format () to add commas in thousands place for a number、Android Studio error: format not a string literal and no format arguments [-Werror=format-security]、Auto format Phone number、Cannot create PoolableConnectionFactory (Invalid number format for port number)的宝贵知识。

本文目录一览:

SQL Server format phone number

SQL Server format phone number

-- Try:

/* format (123) 456-7 to 123-4567 */
select   SUBSTRING('(123) 456-7', 2, 3) + '-' +  SUBSTRING('(123) 456-7', 7, 3) +  SUBSTRING('(123) 456-7', 11, 1)

/* format 123-456-7890 to (123) 456-7890 */
select '(' + SUBSTRING('123-456-7890', 1, 3) + ') ' +  SUBSTRING('123-456-7890', 5, 3) + '-' +  SUBSTRING('123-456-7890', 9, 4)

/* format 1234567 to 123-4567 */
select   SUBSTRING('1234567', 1, 3) + '-' +  SUBSTRING('1234567', 4, 4)

/* format  1234567890  to  (123) 456-7890 */
select '(' + SUBSTRING('1234567890', 1, 3) + ') ' +  SUBSTRING('1234567890', 4, 3) + '-' +  SUBSTRING('1234567890', 7, 4)

 

-- Format:

/* format (123) 456-7 to 123-4567 */
update tableAAA set phone= SUBSTRING(phone, 2, 3) + '-' +  SUBSTRING(phone, 7, 3) +  SUBSTRING(phone, 11, 1)     
where len(phone)=11 and CHARINDEX('(',phone)=1 and CHARINDEX(')',phone)=5  and CHARINDEX('-',phone)=10

/* format 123-456-7890 to (123) 456-7890 */
update tableAAA set phone= '(' + SUBSTRING(phone, 1, 3) + ') ' +  SUBSTRING(phone, 5, 3) + '-' +  SUBSTRING(phone, 9, 4) 
where  len(phone)=12 and CHARINDEX('-',phone)=4 and substring(phone,8,1)='-' and charindex('(',phone)= 0 and charindex(')',phone)= 0

/* format 1234567 to 123-4567 */
update tableAAA set phone=SUBSTRING(phone, 1, 3) + '-' +  SUBSTRING(phone, 4, 4)
where  len(phone)=7 and charindex('-',phone)= 0 and charindex('(',phone)= 0 and charindex(')',phone)= 0

/* format  1234567890  to  (123) 456-7890 */
update tableAAA set phone= '(' + SUBSTRING(phone, 1, 3) + ') ' +  SUBSTRING(phone, 4, 3) + '-' +  SUBSTRING(phone, 7, 4)
where  len(phone)=10 and charindex('-',phone)= 0 and charindex('(',phone)= 0 and charindex(')',phone)= 0

.NET String.Format()在数千个数字中添加逗号 - .NET String.Format () to add commas in thousands place for a number

.NET String.Format()在数千个数字中添加逗号 - .NET String.Format () to add commas in thousands place for a number

问题:

I want to add a comma in the thousands place for a number. 我想在数千个数字中添加一个逗号。 String.Format() ? String.Format() 吗?


解决方案:

参考一: https://stackoom.com/question/RVy/NET-String-Format - 在数千个数字中添加逗号
参考二: https://oldbug.net/q/RVy/NET-String-Format-to-add-commas-in-thousands-place-for-a-number

Android Studio error: format not a string literal and no format arguments [-Werror=format-security]

Android Studio error: format not a string literal and no format arguments [-Werror=format-security]

使用 android studio, 如果编译 jni 过程出现如下错误:

error: format not a string literal and no format arguments [-Werror=format-security]


解决方法:
在你的 ndk 目录下修改 build/core/default-build-commands.mk

TARGET_FORMAT_STRING_CFLAGS := -Wformat -Werror=format-security



 

TARGET_FORMAT_STRING_CFLAGS := -Wformat   #-Werror=format-security

也就是把后面部分注释掉

Auto format Phone number

Auto format Phone number

 

Phone number (123)456-7890

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="TEST.aspx.vb" Inherits="TEST" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
    <script language="javascript" type="text/javascript">

function ValidatePhone(txt){
var phone=txt.value;
if(phone.length==3){
    var pp=phone;
    var d4=phone.indexOf("(");
    var d5=phone.indexOf(")");
    if(d4==-1){    pp="("+pp;    }
    if(d5==-1){    pp=pp+")";    }
    txt.value=pp;
    }
if(phone.length>3){
    d1=phone.indexOf('(');
    d2=phone.indexOf(')');
    if (d2==-1){
        l30=phone.length;
        p30=phone.substring(0,4);
        p30=p30+")";
        p31=phone.substring(4,l30);
        pp=p30+p31;
        txt.value=pp;
    }
  }
if(phone.length>5){
    p11=phone.substring(d1+1,d2);
    if(p11.length>3){
        p12=p11;
        l12=p12.length;
        l15=phone.length;
        p13=p11.substring(0,3);
        p14=p11.substring(3,l12);
        p15=phone.substring(d2+1,l15);
        txt.value="";
        pp="("+p13+")"+p14+p15;
        txt.value=pp;
    }
    l16=phone.length;
    p16=phone.substring(d2+1,l16);
    l17=p16.length;
    if(l17>3&&p16.indexOf('-')==-1){
        p17=phone.substring(d2+1,d2+4);
        p18=phone.substring(d2+4,l16);
        p19=phone.substring(0,d2+1);
        pp=p19+p17+"-"+p18;
        txt.value=pp;
    }
}
}
    </script>

</head>
<body>
    <form id="form1" runat="server">
        <asp:TextBox ID="TextBox1" runat="server" onkeyup='ValidatePhone(this)'></asp:TextBox>
    </form>
</body>
</html>

 

Phone number (123) 456-7890

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="TEST.aspx.vb" Inherits="TEST" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
  

<script language="javascript" type="text/javascript">

function ValidatePhone(txt){
var d4;
var d5;
var d1;
var d2;
var pp;
var phone=txt.value;
if(phone.length==3){
     pp=phone;
     d4=phone.indexOf("(");
     d5=phone.indexOf(")");
    if(d4==-1){    pp="("+pp;    }
    if(d5==-1){    pp=pp+") ";    }
    txt.value=pp;
    }
if(phone.length>3){
     d1=phone.indexOf("(");
     d2=phone.indexOf(")");
    if (d2==-1){
        l30=phone.length;
        p30=phone.substring(0,4);
        p30=p30+") ";
        p31=phone.substring(4,l30);
        pp=p30+p31;
        txt.value=pp;
    }
  }
if(phone.length>5){
    p11=phone.substring(d1+1,d2);
    if(p11.length>3){
        p12=p11;
        l12=p12.length;
        l15=phone.length;
        p13=p11.substring(0,3);
        p14=p11.substring(3,l12);
        p15=phone.substring(d2+1,l15);
        txt.value="";
        pp="("+p13+") "+p14+p15;
        txt.value=pp;
    }
    l16=phone.length;
    p16=phone.substring(d2+2,l16);
    l17=p16.length;
    if(l17>3&&p16.indexOf("-")==-1){
        p17=phone.substring(d2+2,d2+5);
        p18=phone.substring(d2+5,l16);
        p19=phone.substring(0,d2+2);
        pp=p19+p17+"-"+p18;
        txt.value=pp;
    }
}
}
    </script>

</head>
<body>
    <form id="form1" runat="server">
        <asp:TextBox ID="TextBox1" runat="server" onkeyup='ValidatePhone(this)'></asp:TextBox>
    </form>
</body>
</html>

Cannot create PoolableConnectionFactory (Invalid number format for port number)

Cannot create PoolableConnectionFactory (Invalid number format for port number)

今天启动项目时出现这个异常,后来发现连接数据url少了端口号

添加端口号修改成jdbc:oracle:thin:@127.0.0.1:1521:orcl就好了

关于SQL Server format phone number的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于.NET String.Format()在数千个数字中添加逗号 - .NET String.Format () to add commas in thousands place for a number、Android Studio error: format not a string literal and no format arguments [-Werror=format-security]、Auto format Phone number、Cannot create PoolableConnectionFactory (Invalid number format for port number)等相关知识的信息别忘了在本站进行查找喔。

本文标签: