Perl中的函数与Java中的compareTo
()实现相同的功能是什么?我知道eq
和ne
,但我想比较一下,看看一个字符串是否大于另一个。Java的compareTo()函数在Perl中等价吗?
1
A
回答
17
您实际上有cmp
(对于字符串)和<=>
(对于数字)运算符。 见the Equality Operators section in perlop。
例子:
print "foo" cmp "bar"; # prints 1
5
gt
应该做的伎俩
编辑:实际上,cmp
会比较类似的compareTo(),gt
只想告诉你,如果字符串的长度超出那么其他更大。
+0
查看'perldoc perlop'的所有细节 – cam 2010-08-23 20:37:37
相关问题
- 1. Application.DoEvents() - >在java中的等价函数?
- 2. PHP等价于Perl行吗?
- 3. Java中C的“_getch()”的等价函数?
- 4. 这与TAlphaColor的StringToColor函数等价吗?
- 5. C中Java的System.getProperty(“java.io.tmpdir”)等价吗?
- 6. ,与javascript real xml函数等价吗?
- 7. 在Perl中Ruby的irb等价物?
- 8. 等价的NSData:subdataWithRange在Java中?
- 9. 在Java中,PHP的list()函数等价于什么?
- 10. UIBarButtonSystemItem在Android中等价吗?
- 11. SqlBulkCopy在MySql中等价吗?
- 12. DidReceiveRemoteNotification在Android中等价吗?
- 13. str_shuffle()在JavaScript中等价吗?
- 14. BindAsEventListener在jQuery中等价吗?
- 15. Vector2在C++中等价吗?
- 16. Perl的等价PHP的compact()?
- 17. Ruby的等价Perl数据:: Dumper
- 18. GWT中的request.getRemoteUser()等价吗?
- 19. JDB中的GDB'start'等价吗?
- 20. Angular中的getElementById等价吗?
- 21. Python中的inject()等价吗?
- 22. Scala中的'yield'等价于map函数吗?
- 23. C++中的fprint的等价函数
- 24. JavaScript中的返回函数的Java等价物
- 25. + compareTo(wordtoCompare:Word):整数Java
- 26. python中的perror等价函数
- 27. OpenCV中的Matlab Bwareaopen等价函数
- 28. 什么是Haskell中的“::”等价函数?
- 29. greenplum中的ISDATE()等价函数
- 30. java中的等价GroovyMBean
如果你解释什么'compareTo'确实在Java中你会得到这样的问题更好的答案。并不是所有的Perl程序员都知道Java。 – cjm 2010-08-23 21:01:43