jsp中截取一个字符串的一部分,用什么函数?谁能指教?

ecamel 2001-05-23 05:55:00
截取一个字符串的一部分,
ASP中是用left函数,JSP呢
用什么函数?谁能指教?
...全文
513 18 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
18 条回复
切换为时间正序
请发表友善的回复…
发表回复
ecamel 2001-06-04
  • 打赏
  • 举报
回复
我也觉得奇怪。。。。
我明明送分了,且我的总分也减少
怪怪。。。。
handbread 2001-05-30
  • 打赏
  • 举报
回复
我是新来的 很多地方还不明白

要送分在哪里送?

为什么这个问题还是未解决状态 为什么回帖里面都是得0分
ecamel 2001-05-30
  • 打赏
  • 举报
回复
ender
0007
FJY168
我再次送分给以上三个人。
handbread 2001-05-30
  • 打赏
  • 举报
回复
我是指这个问题的分呢

前人回答地这么好 怎么还不见分
ecamel 2001-05-30
  • 打赏
  • 举报
回复
对不起,不是每个人都送,有些人我已经送了,不过不多,本人分数有限。
0007 2001-05-29
  • 打赏
  • 举报
回复
public String substring(int beginIndex)
Returns a new string that is a substring of this string. The substring
begins with the character at the specified index and extends to the end of
this string.

Examples:

"unhappy".substring(2) returns "happy"
"Harbison".substring(3) returns "bison"
"emptiness".substring(9) returns "" (an empty string)

Parameters:
beginIndex - the beginning index, inclusive.

Returns:
the specified substring.

Throws:
IndexOutOfBoundsException - if beginIndex is negative or larger than the
length of this String object.
handbread 2001-05-29
  • 打赏
  • 举报
回复
这家伙怎么只打雷不下雨

分在哪里???

asper 2001-05-29
  • 打赏
  • 举报
回复
oh
FJY168 2001-05-29
  • 打赏
  • 举报
回复
String a="ang;qwjsrejh";

String b=a.substring(0,3);

//then b is "ang"
backlove 2001-05-25
  • 打赏
  • 举报
回复
10分也叫送?自爆先
ecamel 2001-05-25
  • 打赏
  • 举报
回复
准备送分,快快举手!
ender 2001-05-24
  • 打赏
  • 举报
回复
老大,你从来不看JDK的文档的???

public String substring(int beginIndex)
Returns a new string that is a substring of this string. The substring begins with the character at the specified index and extends to the end of this string.
Examples:
"unhappy".substring(2) returns "happy"
"Harbison".substring(3) returns "bison"
"emptiness".substring(9) returns "" (an empty string)

public String substring(int beginIndex,int endIndex)
Returns a new string that is a substring of this string. The substring begins at the specified beginIndex and extends to the character at index endIndex - 1. Thus the length of the substring is endIndex-beginIndex.
Examples:
"hamburger".substring(4, 8) returns "urge"
"smiles".substring(1, 5) returns "mile"
ecamel 2001-05-24
  • 打赏
  • 举报
回复
好像不行吧,你能写完整点吗?
ecamel 2001-05-24
  • 打赏
  • 举报
回复
谢谢各位
hh_ch 2001-05-24
  • 打赏
  • 举报
回复
用StringTokenizer来截取,
例如截取2001-5-6 08:08:08字符串中的前2001-5-6,
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<% String date="2001-5-6 08:08:08";
StringTokenizer tokens=new StringTokenizer(date);
String a=tokens.nextToken();
String b=tokens.nextToken();
out.println("<b>a="+a);
out.println("<b>b="+b);
%>
mirong 2001-05-23
  • 打赏
  • 举报
回复
怎么只有一个参数,找子窜,当然是要两个参数,一个start,一个end。
ender 2001-05-23
  • 打赏
  • 举报
回复
同意……
asper 2001-05-23
  • 打赏
  • 举报
回复
public String substring(int beginIndex)

81,122

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧