标签: split

split(// s +)不要删除空格

我需要读取很多文件并将数据插入到Ms sql中.得到一个文件,看起来文本被// t分隔.拆分不起作用,我甚至尝试使用"// s +",你可以在下面的代码中看到

public void InsetIntoCustomers(final File _file, final Connection _conn)
{
    conn = _conn;
    try
    {

        FileInputStream fs = new FileInputStream(_file);
        DataInputStream in = new DataInputStream(fs);
        BufferedReader br = new BufferedReader(new InputStreamReader(in));

        //String strline contains readline() from BufferedReader
        String strline;

        while((strline = br.readLine()) != null)
        {
            if(!strline.contains("#"))
            {

                String[] test = strline.split("//s+");


                if((tempid = sNet.chkSharednet(_conn, test[0] )) != 0)
                {
                  // do something
                }   
            }
        }

        // close BufferedReader
        br.close();
}
Run Code Online (Sandbox Code Playgroud)

我需要知道我的String []中的数据放在一个500k行的文件中.但我的Test []得到长度1,而readline的所有数据都在0.

我使用拆分错了吗?或者还有其他我需要看的地方吗?:

// Mir …

java string split

0
推荐指数
1
解决办法
513
查看次数

App.config和企业库

我正在使用企业库进行日志记录.所以,为了保持我的配置,我正在使用客户端的app.config.该要求已更改为"拆分EL配置和UI配置".我使用enterpriseLibrary.ConfigurationSource做到了.将配置拆分为app.config(对于UI)和EL.config(对于EL).

现在我想从app.cpnfig中隐藏对这个EL.config的引用,这样就不会对用户隐藏这个EL> config的存在.

App.config代码:

 <enterpriseLibrary.ConfigurationSource selectedSource="EntLib Configuration Source">
<sources>
  <add name="EntLib Configuration Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    filePath="C:\My.CommonServices.Logging\My.CommonServices.Logging\EL.config" />
</sources>
Run Code Online (Sandbox Code Playgroud)

configuration split enterprise-library

0
推荐指数
1
解决办法
3372
查看次数

jquery - 拆分和计算字符?

我正在尝试根据特定字符拆分字符串,然后计算每个部分中的字符数.有没有办法做到这一点?

所以我有:

HTML

<a href="#" class="splitMe" title="Testing | this out">blah</a>
Run Code Online (Sandbox Code Playgroud)

jQuery的

$(document).ready(function() {
   $('.splitMe').each(function() {
      var item = $(this).attr('title');
      var characters = item.split("|");

      // Here's where I get stuck... 
      // Tried various methods of length, but haven't been able to get it to work

      // Most recent version that failed miserably... 
      var first = characters[0].text().length;
      var second = characters[1].text().length;

      alert(first+" "+second); //Yields characters[0] is not a function
   });
});
Run Code Online (Sandbox Code Playgroud)

javascript jquery split

0
推荐指数
1
解决办法
4103
查看次数

如何从字符串中分割数据?

我怎样才能从字符串中分割数据?

我有这样的字符串,

Url=http://www.yahoo.com UrlImage=http://l.yimg.com/a/i/ww/met/yahoo_logo_in_061509.png UrlTitle=Yahoo! India UrlDescription=Welcome to Yahoo!, the world's most visited home page. Quickly find what you're searching for, get in touch with friends and stay in-the-know with the latest news and information.
Run Code Online (Sandbox Code Playgroud)

我想要将这些信息拆分为

http://www.yahoo.com

http://l.yimg.com/a/i/ww/met/yahoo_logo_in_061509.png

Yahoo! India

Welcome to Yahoo!, the world's most visited home page. Quickly find what you're searching for, get in touch with friends and stay in-the-know with the latest news and information.
Run Code Online (Sandbox Code Playgroud)

如何将上面的字符串分成这四个部分并保存到每个部分的临时变量中?

string url = http://www.yahoo.com

string urlImage = http://l.yimg.com/a/i/ww/met/yahoo_logo_in_061509.png

string urlTitle …

c# string split

0
推荐指数
1
解决办法
1128
查看次数

PHP提取文本以句点分隔

我有以下格式的文本:

123232.23

43438282.00

我想将它们提取并存储为两个变量$ dollar和$ cent.

第一个文本的预期结果如下:

$dollar = '123232'

$cent = '23'

如何在PHP 中使用正则表达式实现这一点.

php split

0
推荐指数
1
解决办法
1825
查看次数

C#string.split问题与我的代码

我正在写一些代码来扰乱单词.这是使用不同方法的第二次尝试string.split (' ').

我无法从下面的代码获得我想要的输出.

我试图用代码做的是从console.readline获取一个字符串,然后拆分它并删除任何空格,然后将其输出到console.write.(测试就是这样,我可以看到for循环工作)

所以

input: 1 2 3 4
should be 
output:
1
2
3
4
....



class Program
{
    static void Main(string[] args)
    {
       string input = Console.ReadLine();
       string[] words = input.Split(' ');
        words = new string[10];

        for (int i = 0; i < words.Length; i++)
        {
            words[i] = Console.ReadLine();
            Console.WriteLine(words[i]);
            Console.WriteLine("test");
        }     
    }
}
Run Code Online (Sandbox Code Playgroud)

}

输入:1 2 3 4 5 ......(仅作为测试)

输出:(空白)测试

测试

测试

测试

等等

任何帮助实现拆分工作都会很棒

c# string split

0
推荐指数
1
解决办法
1078
查看次数

在perl中,如何以这种理想的方式分割字符串?

我有一个字符串 str a\tb\tc\td\te

我希望第一个字段值a进入变量,然后第二个字段值b进入其他变量,然后c\td进入第三个变量和最后一个字段值e进入一个变量.

如果我做

my ($a,$b,$c,$d) = split(/\t/,$_,4);
Run Code Online (Sandbox Code Playgroud)

$c只会收购c和$d将收购d\te

我可以:

my ($a,$b,$c) = split(/\t/,$_,3);
Run Code Online (Sandbox Code Playgroud)

然后c会得到c\td\te ,我可以以某种方式(如何?)摆脱最后的价值并把它拿进去$d

怎么做到这一点?

perl split chop chomp

0
推荐指数
1
解决办法
664
查看次数

如何在python中的代码点上拆分unicode字符串?(例如,\ u00B7或\ u2022)?

我尝试了一切我能想到的......

1. unicode_obj.split('\u2022')
2. re.split(r'\u2022', unicode_object)
3. re.split(r'(?iu)\u2022', unicode_object)
Run Code Online (Sandbox Code Playgroud)

没有任何效果

问题是我想拆分特殊字符.

example string : u'<special char like middot:\u00b7 or bullet:\u2022> sdfhsdf <repeat special char> sdfjhdgndujhfsgkljng <repeat special char> ... etc'
Run Code Online (Sandbox Code Playgroud)

请帮忙.

提前致谢.

python unicode split codepoint points

0
推荐指数
1
解决办法
1809
查看次数

将"first,middle,middle,last"拆分为包含3个元素的数组(first,middle,last)

我想将以下字符串拆分为三个元素:

first, middle, middle, middle, middle, last
Run Code Online (Sandbox Code Playgroud)

结果将是:

splits[0] = "first"
splits[1] = "middle, middle, middle, middle"
splits[2] = "last"
Run Code Online (Sandbox Code Playgroud)

我不知道这是否最好用正则表达式或字符串方法完成.

c# regex string split

0
推荐指数
1
解决办法
1024
查看次数

使用'in C#拆分字符串

如何拆分此字符串

1014,'0,1031,1032,1034,1035,1036',0,0,1,1,0,1,0,-1,1
Run Code Online (Sandbox Code Playgroud)

并获得此字符串数组作为结果

1014
'0,1031,1032,1034,1035,1036'
0
0
1
1
0
1
0
-1
1
Run Code Online (Sandbox Code Playgroud)

在C#中

c# string split

0
推荐指数
1
解决办法
2490
查看次数