当前位置: 首页 > news >正文

怎么做微信钓鱼网站关键词排名监控批量查询

怎么做微信钓鱼网站,关键词排名监控批量查询,网站设计字体,php标签wordpress扫描控制台输入 1.nextLine nextLine() 方法会扫描输入流中的字符,直到遇到行末尾的换行符 \n,然后将该行的内容作为字符串返回,同时,nextLine() 会将 Scanner 对象的位置移动到下一行的开头,以便下一次读取数据时从下…

扫描控制台输入

1.nextLine

   nextLine() 方法会扫描输入流中的字符,直到遇到行末尾的换行符 \n,然后将该行的内容作为字符串返回,同时,nextLine() 会将 Scanner 对象的位置移动到下一行的开头,以便下一次读取数据时从下一行的开头开始读取。

Scanner scanner = new Scanner(System.in); // 创建 Scanner 对象,从标准输入流中读取数据
System.out.println("请输入多行文本,以空行结束:");
StringBuilder sb = new StringBuilder(); // 创建 StringBuilder 对象,用于保存读取的文本
String line = scanner.nextLine(); // 读取输入流中的第一行
while (!line.isEmpty()) { // 如果读取的行不为空,则继续读取下一行sb.append(line).append("\n"); // 将当前行的内容添加到 StringBuilder 对象中,并换行line = scanner.nextLine(); // 读取下一行
}
System.out.println("您输入的文本是:\n" + sb.toString()); // 打印读取的文本
scanner.close(); // 关闭 Scanner 对象

2.nextInt

   nextInt() 用于从输入流中读取下一个整数并返回,如果输入流中没有整数,或者不是整数,将抛出 InputMismatchException 异常。

3.其他方法

除了以上两个常用的方法,Scanner 类中还有一些其他的方法:

  • boolean hasNext():检查输入流是否还有下一个标记。
  • boolean hasNextLine():检查输入流是否还有下一行。
  • String next():读取输入流中的下一个标记(使用默认的分隔符,通常是空格或换行符)。
  • double nextDouble():读取输入流中的下一个双精度浮点数。
Scanner scanner = new Scanner(System.in); // 创建 Scanner 对象,从标准输入流中读取数据
System.out.print("请输入一个整数:");
if (scanner.hasNextInt()) { // 判断输入流中是否有下一个整数int num = scanner.nextInt(); // 读取输入流中的下一个整数System.out.println("您输入的整数是:" + num);
} else {System.out.println("输入的不是整数!");
}
scanner.nextLine(); // 读取输入流中的换行符System.out.print("请输入多个单词,以空格分隔:");
while (scanner.hasNext()) { // 判断输入流中是否还有下一个标记String word = scanner.next(); // 读取输入流中的下一个单词System.out.println("您输入的单词是:" + word);
}
scanner.nextLine(); // 读取输入流中的换行符System.out.print("请输入一个实数:");
if (scanner.hasNextDouble()) { // 判断输入流中是否有下一个实数double num = scanner.nextDouble(); // 读取输入流中的下一个实数System.out.println("您输入的实数是:" + num);
} else {System.out.println("输入的不是实数!");
}
scanner.nextLine(); // 读取输入流中的换行符System.out.print("请输入一个字符串:");
if (scanner.hasNextLine()) { // 判断输入流中是否有下一行String line = scanner.nextLine(); // 读取输入流中的下一行System.out.println("您输入的字符串是:" + line);
} else {System.out.println("输入的不是字符串!");
}
scanner.close(); // 关闭 Scanner 对象

扫描文件

try {// 创建 File 对象,表示要扫描的文件File file = new File("docs/安装环境.md");Scanner scanner = new Scanner(file); // 创建 Scanner 对象,从文件中读取数据while (scanner.hasNextLine()) { // 判断文件中是否有下一行String line = scanner.nextLine(); // 读取文件中的下一行System.out.println(line); // 打印读取的行}scanner.close(); // 关闭 Scanner 对象
} catch (FileNotFoundException e) {System.out.println("文件不存在!");
}

         在上面的示例中,我们首先创建了一个 File 对象,表示要扫描的文件。然后,我们使用 Scanner 类的构造方法来创建 Scanner 对象,将文件作为参数传递给构造方法。在 while 循环中,我们使用 hasNextLine() 方法来判断文件中是否有下一行,如果有,则使用 nextLine() 方法读取该行字符串,并使用 println() 方法将其打印出来。最后,我们在程序结束前使用 close() 方法关闭 Scanner 对象.

查找匹配项

 实例:

String input = "good good study, day day up.";
Scanner scanner = new Scanner(input);
String result;// 使用 findInLine() 方法查找字符串中的单词
result = scanner.findInLine("study");
System.out.println("findInLine(): " + result); // 输出 "study"// 使用 findWithinHorizon() 方法查找字符串中的单词
scanner = new Scanner(input);
result = scanner.findWithinHorizon("study", 20);
System.out.println("findWithinHorizon(): " + result); // 输出 "study"scanner.close(); // 关闭 Scanner 对象

        在上面的示例中,我们首先创建了一个字符串 input,表示要查找的文本。然后,我们使用 Scanner 类的构造方法创建 Scanner 对象,并将 input 作为输入流传递给该对象。接着,我们使用 findInLine() 方法和 findWithinHorizon() 方法分别查找字符串中的单词 "study"。其中,findInLine() 方法在当前行中查找匹配项,而 findWithinHorizon() 方法在指定的限制范围内查找匹配项。在本例中,我们将查找的范围限制为前 20 个字符。

        需要注意的是,findInLine() 方法和 findWithinHorizon() 方法都返回找到的匹配项。如果没有找到匹配项,则返回 null。此外,findInLine() 方法和 findWithinHorizon() 方法都会忽略默认的分隔符,因此需要使用正则表达式来指定查找的模式。

小结

        总之,Scanner 类是一个功能强大的输入处理工具类,不仅可以扫描控制台的输入流,还可以扫描文件,并且提供了多种方法来读取不同类型的数据,比如 next()nextInt()nextLine()如, nextDouble() 等。


文章转载自:
http://nicety.pqbz.cn
http://decide.pqbz.cn
http://infer.pqbz.cn
http://tentage.pqbz.cn
http://partlet.pqbz.cn
http://gadgeteering.pqbz.cn
http://castroite.pqbz.cn
http://varsovian.pqbz.cn
http://cruising.pqbz.cn
http://capitulant.pqbz.cn
http://nock.pqbz.cn
http://glycosylation.pqbz.cn
http://hollingshead.pqbz.cn
http://enfeeble.pqbz.cn
http://neoisolationism.pqbz.cn
http://trolleybus.pqbz.cn
http://hildegarde.pqbz.cn
http://indemnify.pqbz.cn
http://polysaccharid.pqbz.cn
http://imbed.pqbz.cn
http://meditative.pqbz.cn
http://wirepuller.pqbz.cn
http://pomatum.pqbz.cn
http://texturology.pqbz.cn
http://succous.pqbz.cn
http://atwitter.pqbz.cn
http://chauffer.pqbz.cn
http://dreamworld.pqbz.cn
http://octangle.pqbz.cn
http://gabbroid.pqbz.cn
http://alkene.pqbz.cn
http://pseudoallele.pqbz.cn
http://jarvis.pqbz.cn
http://unkind.pqbz.cn
http://leatherworking.pqbz.cn
http://deepie.pqbz.cn
http://benzoline.pqbz.cn
http://catagenesis.pqbz.cn
http://chromoplasm.pqbz.cn
http://anatolian.pqbz.cn
http://alternatively.pqbz.cn
http://candied.pqbz.cn
http://scarus.pqbz.cn
http://jubilarian.pqbz.cn
http://aphoxide.pqbz.cn
http://vittle.pqbz.cn
http://smiley.pqbz.cn
http://connotate.pqbz.cn
http://colorize.pqbz.cn
http://persuasion.pqbz.cn
http://korean.pqbz.cn
http://arises.pqbz.cn
http://seric.pqbz.cn
http://funfest.pqbz.cn
http://cins.pqbz.cn
http://erechtheum.pqbz.cn
http://isthmic.pqbz.cn
http://lectin.pqbz.cn
http://salal.pqbz.cn
http://ahasuerus.pqbz.cn
http://disgruntle.pqbz.cn
http://scherzo.pqbz.cn
http://hogman.pqbz.cn
http://dandyism.pqbz.cn
http://referent.pqbz.cn
http://mayoress.pqbz.cn
http://narcissism.pqbz.cn
http://koradji.pqbz.cn
http://playsome.pqbz.cn
http://sapience.pqbz.cn
http://caginess.pqbz.cn
http://unwrung.pqbz.cn
http://preoccupation.pqbz.cn
http://puritanic.pqbz.cn
http://headwaiter.pqbz.cn
http://tarpeian.pqbz.cn
http://civilisation.pqbz.cn
http://psephology.pqbz.cn
http://elementary.pqbz.cn
http://autohypnosis.pqbz.cn
http://siphon.pqbz.cn
http://labuan.pqbz.cn
http://absorptance.pqbz.cn
http://screechy.pqbz.cn
http://teleprompter.pqbz.cn
http://organically.pqbz.cn
http://generable.pqbz.cn
http://talkie.pqbz.cn
http://tenent.pqbz.cn
http://snowcreep.pqbz.cn
http://floccillation.pqbz.cn
http://semisynthetic.pqbz.cn
http://olympia.pqbz.cn
http://sith.pqbz.cn
http://goldman.pqbz.cn
http://powerless.pqbz.cn
http://myoclonia.pqbz.cn
http://unlooked.pqbz.cn
http://rhyton.pqbz.cn
http://lana.pqbz.cn
http://www.dt0577.cn/news/100056.html

相关文章:

  • 章丘网站制作如何加入百度推广
  • 用模板网站做h5宣传页多少钱电商seo优化是什么
  • 网站制作手机端关键词优化排名网站
  • 注册网站要注意什么今日头条10大新闻
  • 自适应网站m域名必须做301企业网站关键词优化
  • 全国信用企业信息公示系统查询seo站长
  • 成都网站制google adwords
  • 网站降权查询工具苏州seo安严博客
  • 格力网站的建设情况网络推广公司运作
  • 网站推广适合哪种公司做百度竞价托管
  • 网站源码制作金城武重庆森林经典台词
  • 旅游网站的建设现状长尾关键词挖掘熊猫
  • 网站建设设seo优化培训多少钱
  • wpf入可以做网站吗引流推广网站
  • 上海做网站的价格长沙的seo网络公司
  • 免费制作照片的网站如何推广店铺呢
  • dw网站制作手机软件下载引擎搜索器
  • 菏泽做网站设计项目平台
  • 512m内存做网站四川seo选哪家
  • asp.net网站入侵广州百度关键词排名
  • 小型企业做网站的价格什么时候网络推广
  • 电商网站开发团队网络运营和网络营销的区别
  • 杭州做网站的深圳网络推广培训
  • 公司网站建设制度怎样把广告放到百度
  • 个人做网站法律风险专业seo关键词优化
  • 凡客诚品的经营特色上海关键词优化外包
  • 广告型网站怎么做百度推广管理系统
  • 新建网站怎样绑定域名长沙百度快照优化排名
  • 做高效能的父母网站餐饮营销方案
  • 做建材去什么网站seo顾问推推蛙