- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我试图找出某个状态在一列 csv 文件中出现的次数。它还只打印一半的州。我的代码如下
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Arrays;
public class csvtxt {
public static void main(String a[]){
StringBuilder sb = new StringBuilder();
String strLine = "";
List<String> list = new ArrayList<String>();
try {
BufferedReader br = new BufferedReader(new FileReader("C:\\Users\\dbb38\\Downloads\\customers_export_111 - customers_export_1 (1).csv"));
while (strLine != null)
{
strLine = br.readLine();
sb.append(strLine);
sb.append(System.lineSeparator());
strLine = br.readLine();
if (strLine==null)
break;
list.add(strLine);
}
//
String wordToSearchFor = "Alabama";
int Alabama = 0;
for(String Alabama1 : list)
{
if(Alabama1.equals(wordToSearchFor))
{
Alabama++;
}
}
System.out.println("Alabama = " + "["+ Alabama +"]");
//
String wordToSearchFor1 = "Alaska";
int Alaska = 0;
for(String Alaska1 : list)
{
if(Alaska1.equals(wordToSearchFor))
{
Alaska++;
}
}
System.out.println("Alaska = " + "["+ Alaska +"]");
//
String wordToSearchFor2 = "Arizona";
int Arizona = 0;
for(String Arizona1 : list)
{
if(Arizona1.equals(wordToSearchFor))
{
Arizona++;
}
}
System.out.println("Arizona = " + "["+ Arizona +"]");
//
System.out.println(Arrays.toString(list.toArray()));
br.close();
} catch (FileNotFoundException e) {
System.err.println("File not found");
} catch (IOException e) {
System.err.println("Unable to read the file.");
}
}
}
这是我得到的输出。我切断了一些输出,因为 95881 字符太多。
Alabama = [138]
Alaska = [138]
Arizona = [138]
[ South Dakota, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Tennessee, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Texas, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Utah, Vermont, Vermont, Vermont, Vermont, Vermont, Vermont, Vermont, Vermont, Vermont, Vermont, Vermont, Vermont, Vermont, Vermont, Vermont, Vermont, Vermont, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia, Virginia]
佛蒙特州应该有 35 个,但它只打印了其中的 17 个。任何帮助将不胜感激!a
最佳答案
替换
if(Arizona1.equals(wordToSearchFor))
与
if(Arizona1.equals(wordToSearchFor2))
您也需要对其他人进行类似的更改。看到你的错误了吗?
关于java - 为什么当我询问这个词出现了多少次时,我总是得到 138,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60364359/
我有一个名为 Driver 的表。日期数据类型中有一个名为birthDate 的列。输入为“1995-05-18”YEAR-MONTH-DATE 我需要查询列出 1950 年、1960 年、1970
我只是想知道是否所有浏览器都支持 DELETE 语句,例如: delete myObj; 我只想 100% 确定是否所有浏览器都支持这个?还有没有浏览器或移动电话不支持? 最佳答案 Mozilla's
我想这样做,但到目前为止,我所拥有的只是: print("Will you go out with me?") 我希望代码能够正常工作,以便人们可以回答“是/否”,如果回答是"is",则将返回一条消息
检查 SPARQL 资源是否存在的好方法是什么? 我正在寻找相当于向例如发射 HTTP GET 请求的方法http://dbpedia.org/resource/Game_of_Thrones并检查
this is my code and in the last part,msgrecv does not accept the messages from the queue accourding
我正在使用 TinyMCE 5。我定义了一个 image_list,我需要在页面其他地方操作图像时动态更改它。为此,我先调用 tinymce.remove(),然后调用 tinyme.init(),使
我想在我的 C 程序中使用以下脚本。用户将能够输入IP。之后我想确定输入是否正确并询问用户 char eingabe; printf("Is that the right input? y/n: ")
我有一个 Java 源代码,我需要它来查询和应用安全策略 [例如申请CWE] 我有几个想法,首先是使用 AST,然后遍历树。其他包括使用正则表达式。除了 AST 或正则表达式之外,还有其他选项可供我用
有没有办法以编程方式询问 c3p0 有多少连接正在使用,或者在池耗尽时记录。 最佳答案 如上面 Austin 评论引用的 URL 所示,您可以使用 JMX 来检查和修改正在运行的 c3p0 Poole
我的 SQL 表遇到了另一个问题,但这次我有更多的表链接在一起。我意识到了什么以及我陷入困境的地方: 我有关于工作、工资、员工的表格。 我已经按照以下条件进行了查询: 我公司工资最高的员工: sele
这个问题不太可能对任何 future 的访客有帮助;它只与一个较小的地理区域、一个特定的时间点或一个非常狭窄的情况相关,通常不适用于全世界的互联网受众。如需帮助使此问题更广泛适用,visit the
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 8 年前。 Improve this qu
询问 MethodInfo 是否接受参数的最有效方法是什么?如果接受,有多少? 我目前的解决方案是:methodInfo.GetParameters().Any() 和 methodInfo.GetP
我为我的应用程序添加了一个文本到语音搜索器,这样我就可以用语音过滤列表,一切正常,唯一的问题是我必须从应用程序的权限选项选项卡中手动接受权限。 我正在使用 speech_recognition为它打包
我有一个使用 FFMPEG 的 sh 脚本从 RTSP 流中拍摄一张照片。 如果连接时间过长,有一个 timeout -stimeout 来终止连接。 (-timeout 是不可能的)。大多数 IP
基本上我想要的是不必每次在 git 中提交时都输入密码。 在寻找解决方案时,我发现了 this . 所以它告诉我在配置文件中设置 default-cache-ttl 和 max-cache-ttl 。
如果 id="e2"被 id="e1"填充,如何填充 id="e3"? 在这里检查实时代码,http://jsfiddle.net/eHEtV/ jQuery(document).ready(func
我有以下代码,它是 PHP 中将用户添加到数据库的函数的一部分。它将用户添加到数据库中。 if($user != '' && $pass != ''){ $new_name_q
我如何实现这段代码: $("ID5").click(function{ $("#Id1,#Id2" + this).hide(); }); 最佳答案 我认为你需要.add() ,它将元素添加到匹
这个问题在这里已经有了答案: Java8 - how to know if daylight savings is on now (1 个回答) 关闭 6 年前。 如何询问 java.time.Zo
我是一名优秀的程序员,十分优秀!