小编Aif*_*ify的帖子

如何用C#在回车上拆分字符串?

我有一个ASP.NET页面,其中包含一个名为txbUserName的多行文本框.然后我将3个名称粘贴到文本框中,它们是垂直对齐的:

  • 贾森
  • 书童
  • 卡伦

我希望能够以某种方式获取名称,并在检测到回车或新行时将它们拆分为单独的字符串.我认为阵列可能是要走的路.有任何想法吗?

谢谢.

c# text-manipulation

57
推荐指数
2
解决办法
8万
查看次数

TextToSpeech:API Level 21中不推荐使用的发言功能

我尝试在我的应用中使用TextToSpeech,

String text = editText.getText().toString();
tts.speak(text, TextToSpeech.QUEUE_FLUSH, null);
Run Code Online (Sandbox Code Playgroud)

但函数说(String text,int queueMode,HashMap params)在API Level 21中已被弃用.而不是这样,建议使用speak(CharSequence text,int queueMode,Bundle params,String utteranceId).但我不知道如何设置它.谢谢

android text-to-speech

18
推荐指数
1
解决办法
1万
查看次数

使用Git将master中的更改合并到所有分支中?

我使用git来维护代码的多个工作副本.我的想法是,我可以检查任何分支,构建并运行它,以查看分支的特征x如何适应代码的当前状态.

Git的主分支是Trunk,其他git分支是我想尝试的功能或事物.因此,我的典型用法是使用最新修补程序更新master,然后将master合并到各个分支中,以便每个分支都保持最新.

这个系统适合我,除了我必须结帐分支,合并主人和冲洗/重复其他分支.鉴于像git这样的版本控制系统,我认为这种扩展并不是很好,因为随着时间的推移,我很容易产生很多分支.

我仍然是一个初学者,所以我怀疑可能有一种git已经存在的机制,我可能会失踪.有吗?如果没有,那么如何对所有分支机构进行更改以使其保持最新状态?

git merge branch

14
推荐指数
2
解决办法
2911
查看次数

项目无法在Intellij上打开

我刚刚添加了一些插件到intellijIdea版本14.0.1,重新启动它,我的项目可以加载.

这是错误消息

Cannot load project: com.intellij.ide.plugins.PluginManager$StartupAbortedException: com.intellij.diagnostic.PluginException: Bad type on operand stack
Exception Details:
  Location:
    com/intellij/atg/jsp/OpenDspInclude.registerTags(Lcom/intellij/psi/PsiReferenceProvider;Ljava/lang/String;Lcom/intellij/psi/filters/position/NamespaceFilter;[Ljava/lang/String;)V @19: invokestatic
  Reason:
    Type 'com/intellij/psi/impl/source/resolve/reference/ReferenceProvidersRegistry' (current frame, stack[0]) is not assignable to 'com/intellij/psi/PsiReferenceRegistrar'
  Current Frame:
    bci: @19
    flags: { }
    locals: { 'com/intellij/atg/jsp/OpenDspInclude', 'com/intellij/psi/PsiReferenceProvider', 'java/lang/String', 'com/intellij/psi/filters/position/NamespaceFilter', '[Ljava/lang/String;' }
    stack: { 'com/intellij/psi/impl/source/resolve/reference/ReferenceProvidersRegistry', '[Ljava/lang/String;', 'com/intellij/psi/filters/ScopeFilter', 'com/intellij/psi/PsiReferenceProvider' }
  Bytecode:
    0000000: 2ab4 001c 04bd 0031 5903 2c53 2d19 04b8
    0000010: 004f 2bb8 0055 b1                      
 [Plugin: OpenDSPInclude]
Run Code Online (Sandbox Code Playgroud)

java intellij-idea

6
推荐指数
1
解决办法
5221
查看次数

将时区更改为伦敦时的日期问题

我有以下代码:

package com.company.customer;

import java.util.*;
import java.text.*;
import java.io.*;

public class DateSample {
    private TimeZone GMT_TIMEZONE = TimeZone.getTimeZone("GMT");
    private SimpleDateFormat sdfDate = new SimpleDateFormat();
    private Date inputDate;
    private String dateInString = "2015-07-15";
    private DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");

    public void datePrint() {
        sdfDate.setTimeZone(GMT_TIMEZONE);
        sdfDate.applyPattern("EE-ddMMM");

        try {
            inputDate = formatter.parse(dateInString);
        } catch (Exception e) {
            System.out.println("populateTabDates: ParseException");
        }

        String formatResults = sdfDate.format(inputDate);

        // Modify the return to cut down the weekday: Fri-20Aug => Fr-20Aug
        formatResults = formatResults.substring(0, 2) + formatResults.substring(3);

        System.out.println(formatResults); …
Run Code Online (Sandbox Code Playgroud)

java date

2
推荐指数
1
解决办法
75
查看次数

PHP字符串操作

我正在读取格式的文本文件

电话号码(标签)文字(换行符)(换行符)

或者更具体地说

4799999999  Hey! You owe us $576.53. Pay up to account no. 9760.00.12345, ID: 201561438.

4798888888  Hey! You owe us $199. Pay up to account no. 9760.05.12345, KID: 201565173.

4797777777  Hey! You owe us... and so on.
Run Code Online (Sandbox Code Playgroud)

我想将它存储在SQL数据库中,因此我需要在电话号码和文本中将其分开.

关于如何在PHP中将字符串拆分成对的任何想法?我应该在保存到SQL之前将这些值存储在Array中,还是应该立即存储它?

php text-manipulation

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

VB到Delphi字符串操作代码转换

我有一些VB源代码,并希望将其转换为Delphi:

Do While Not EOF(textfile)
Line Input #textfile, Line

Dim retstring() As String         
retstring = Split(Line, Chr(32))
first  = retstring(0)
second = retstring(1)
Run Code Online (Sandbox Code Playgroud)

我有一些文本文件与这些类似的行:

hello all
nice to
good day

我在答案中尝试了一些源代码,但仍然遇到问题.我看到消息'你好'和'很好',但实际上我想看到'你好'和'全'而不是.

procedure TForm1.BitBtn1Click(Sender: TObject);
var
  list : TStringList;
  first, second, third: string;
begin
  list := TStringList.Create;
  try
    list.Delimiter := #32;
    list.LoadFromFile('test.txt');
    first := list[0];
    second := list[1];
    ShowMessage(first);
    ShowMessage(second);
  finally
    list.Free;
  end;
end;
Run Code Online (Sandbox Code Playgroud)

delphi text-manipulation

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