Description:
I use the Groovy language, but it is quite Java compatible, except that it is a weakly typed language relative to Java
Situation:
If a string is null, no unit will be added. The screenshot is shown below, and the data after “Distance (m) :” should be intercepted
Original script:
I use the Groovy language, but it is quite Java compatible, except that it is a weakly typed language relative to Java
Situation:
If a string is null, no unit will be added. The screenshot is shown below, and the data after “Distance (m) :” should be intercepted
Original script:
if( !distance.endsWith(")") && !distance.endsWith("m") && distance != null && distance.length() != 0) {
distance = distance + 'm';
}
Error: Collection exception. Exception information [Java. Lang. ClassCastException: Java. Lang. Integer always be cast to Java. Lang. Boolean]
Later changed the script:
if(!distance.endsWith(")") && !distance.endsWith("m") && distance != null && distance.toString().length() != 0) {
distance = distance + 'm';
}
Exception resolution. Integer is int the wrapper class, there is no length () this method, the specific introduction, see this post:
https://blog.csdn.net/andyzhaojianhui/article/details/84324466
Read More:
- Record a problem of no module named ‘tensorflow. Examples’ and’ tensorflow. Examples. Tutorials’ in tensorflow 2.0
- Beef combined with Metasploit under Kali
- Python combined with Matplotlib to add button
- Examples of VTK image reading and display
- PHP in Windows combined with bat batch processing to achieve multi process verification proxy server function
- Usage and examples of three important functions of tidyr package in R language: gather, spread and separate
- Deploy mongodb fragment combined with replica set to realize distributed storage of MySQL database files (step 10)
- [Python] numpy library array splicing np.concatenate Detailed explanation and examples of official documents
- Java encrypts the string with MD5
- How to Fix stack overflow error
- Brief introduction of idea Lombok and solutions for reporting red and wrong
- java.util.Collections.max() [How to Use]
- CMake_ Compiling VTK_ 9.0.0 running vtkcommoncolor DLL has access conflict
- [Two Sigma OA] Longest Chain
- In Java, int is converted to string, and zero is added before the number of bits is insufficient
- Error reporting: java.lang.nullpointerexception solution
- Error in Maven clean or package
- ES6 determines what the string begins with or ends with
- stay web.xml Configure error page in
- java.lang.IllegalArgumentException : urlcoder exception resolution