String
这个昵称有十五个字不信你数数
我有点可爱哈哈哈哈哈哈哈
展开
-
Java中String的==和isEmpty()的区别
我们首先来看下面几个示例:import java.util.*;public class Test { public static void main(String []args) { String s1 = new String(); String s2 = ""; String s3 = null; String s4; if(s1 == null) { System.out.println("s1_1"); } if(s1.isEmpty())原创 2021-04-20 12:22:19 · 309 阅读 · 0 评论 -
[LeetCode] 600. Non-negative Integers without Consecutive Ones (java)
Given a positive integer n, find the number ofnon-negativeintegers less than or equal to n, whose binary representations do NOT containconsecutive ones.Example 1:Input: 5Output: 5Explanation...原创 2020-03-07 11:46:00 · 154 阅读 · 0 评论 -
[LeetCode] 592. Fraction Addition and Subtraction (java)
Given a string representing an expression of fraction addition and subtraction, you need to return the calculation result in string format. The final result should beirreducible fraction. If your fin...原创 2020-02-27 13:22:07 · 196 阅读 · 0 评论 -
java String类方法总结
1、获取字符串长度:length()2、获取字符串第i个位置的字符:charAt(i)3、获取指定字符或者字符串的位置:indexOf(ch)返回的是第一次出现位置的索引 无指定字符或字符串返回-1indexOf(ch,fromIndex)返回fromIndex之前第一次出现的位置索引lastIndexOf(ch)返回的是最后一次出现的位置索引lastIndexOd(...原创 2019-08-28 10:23:15 · 342 阅读 · 0 评论