大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
package com.lp.test;
创新互联建站长期为成百上千客户提供的网站建设服务,团队从业经验10年,关注不同地域、不同群体,并针对不同对象提供差异化的产品和服务;打造开放共赢平台,与合作伙伴共同营造健康的互联网生态环境。为修水企业提供专业的成都网站设计、成都做网站、外贸网站建设,修水网站改版等技术服务。拥有10多年丰富建站经验和众多成功案例,为您定制开发。
public class StringTest {
public static void main(String[] args) {
// TODO code application logic here
//打印main方法参数
if (args.length 0) {
for (int i = 0; i args.length; i++) {
System.out.println(args[i]);
}
} else {
System.out.println("No args.");
}
String str = "12345";
//将str拆分为单个char输出
for (int i = 0; i str.length(); i++) {
System.out.print(str.charAt(i) + " ");
}
System.out.println("");
//截取str前四位
str = str.substring(0, 4);
System.out.println(str);
//将截取后的str与"77777"进行拼接
str = str.concat("77777");
System.out.println(str);
//输出7在str中第一次出现的位置
int index = str.indexOf('7');
System.out.println(index);
//获取7在str中最后一次出现的位置
int lastIndex = str.lastIndexOf('7');
System.out.println(lastIndex);
//将str中的7全部换为6
str = str.replace('7', '6');
System.out.println(str);
//将str中第一次出现的"6666"置换为"5"
str = str.replaceAll("6666", "5");
System.out.println(str);
//初始化一个包含"12345"的字符串缓冲对象
StringBuilder strb = new StringBuilder("12345");
//循环输出字符串缓冲对象的内容
for (int i = 0; i strb.length(); i++) {
System.out.print(strb.charAt(i) + " ");
}
System.out.println("");
//删除strb中索引为4的字符
strb.deleteCharAt(4);
System.out.println(strb);
//在删除字符后的strb中拼接"77777"
strb.append("77777");
System.out.println(strb);
//在索引为4芳容位置上插入"56";
strb.insert(4, "56");
System.out.println(strb);
//颠倒strb中的字符顺序
strb.reverse();
System.out.println(strb);
String hello = "HelloWord";
//将hello字符串转换为全小写
System.out.println(hello.toLowerCase());
//将hello字符串转换为全大写
System.out.println(hello.toUpperCase());
}
}
没有翻译软件,但是能编写翻译程序。
java 代码翻译实例:
1.输入一个以’@’结束的字符串,从左至右翻译。若下一个字符是数字n(0≤n≤9),表示后一个字符重复n+1 次,不论后一个字符是否为数字;若下一个字符非数字,则表示自己。
2.翻译后,以3 个字符为一组输出,组与组之间用空格分开。
例如’A2B5E34FG0ZYWPQ59R@’,翻成’ABB_BEE_EEE_E44_44F_GZY_WPQ_999_999_R@ ’。
3.分析:首先直接遍历数组把字符串按要求进行翻译,然后将翻译后的字符串进行分组形成字符串数组,最后把字符串数组用下划线连接输出。
java翻译源代码:
import java.util.Scanner;
public class Main5{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String s = in.nextLine();
int length = s.length();
String result = "";
char[] str = new char[length]
for (int i = 0; i length; i++) {
str[i] = s.charAt(i);
}
result += str[0];
if (str[length - 1] != '@') {
System.out.println("输入有误!");
} else {
for (int index = 0; index length - 1;) {
if ('0' == str[index + 1] || '1' == str[index + 1] || '2' == str[index + 1] || '3' == str[index + 1]
|| '4' == str[index + 1] || '5' == str[index + 1] || '6' == str[index + 1]
|| '7' == str[index + 1] || '8' == str[index + 1] || '9' == str[index + 1]) {
for (int i = 0; i ((Integer.parseInt(str[index + 1]+"")) + 1); i++) {
result += str[index + 2];
}
index += 2;
} else {
result += str[index + 1];
index++;
}
}
}
System.out.println(getGroup(result));
}
//每3个分一组
public static String getGroup(String s){
String[] r;
if(s.length()%3 == 0){
r = new String[s.length()/3];
}else{
r = new String[s.length()/3+1];
}
String result = "";
int j = 0;
for(int i=0;is.length();){
if(i+3 = s.length()){
r[j]=s.substring(i, i+3);
j++;
i += 3;
}else{
r[j] = s.substring(i);
j++;
i += 3;
}
}
for(int i=0;ir.length-1;i++){
result += (r[i]+"_");
}
result += r[r.length-1];
return result;
}
}
Important: This is not a supported means of building Tomcat; this information is provided without warranty :-).重要:这不是一个建立Tomcat的支持手段,这方面的资料提供不附带:-)。 The only supported means of building Tomcat is with the "ant build" described above. Tomcat的建设支持的唯一途径是与“蚁建立上述”。 However, some developers like to work on Java code with a Java IDE, and the following steps have been used by some developers.但是,一些开发人员喜欢在Java代码与一个Java IDE,和下面的步骤是由一些开发人员使用。
Note that you must complete all the above steps to fetch the repositories and build some JAR files the first time.请注意,您必须完成所有上述步骤获取的资料库和兴建一些JAR文件的第一次。 After you have completed the above steps, you can set up a series of Eclipse 4 projects.在完成上述步骤后,您可以设置一个Eclipse的一系列4个项目。 Note that this will not let you build everything under Eclipse; the build process requires use of Ant for the many stages that aren't simple Java compilations.请注意,这不会让你在Eclipse中建立的一切,在生成过程需要使用蚂蚁的许多阶段,这不是简单的Java汇编。 However, it will allow you to view and edit the Java code, get warnings, reformat code, perform refactorings, run Tomcat under the IDE, and so on.但是,它可以让你查看和编辑Java代码,得到警告,重新格式化代码,执行重构,在IDE下运行Tomcat的,等等。
You will want to set up your Eclipse project for building Tomcat such that ${tomcatSource} is the Workspace folder.您将要建立的Eclipse项目的建设,这样Tomcat的$(tomcatSource)是工作区文件夹。
Use Windows-Preferences and then Java-Build Path-Classpath Variables to add two new Classpath variables:使用Windows -“首选项,然后Java的”构建路径“类路径变量增加两个新的类路径变量:
TOMCAT_LIBS_BASE the base path where the binary dependencies have been downloaded TOMCAT_LIBS_BASE基二元路径依赖已下载
ANT_HOME the base path of Ant 1.6.2 or later ANT_HOME的蚂蚁1.6.2或更高基路径
Use File-New Project to create a new Java project for each of the binaries repository (eg, /usr/share/java), container, connectors, jasper, servletapi.使用文件“新建项目,以创造一个二进制库的每一个新的Java项目(例如/ usr /共享/爪哇),容器,连接器,碧玉,servletapi。 If you didn't already set up the Eclipse project such that ${tomcat.source} is the Workspace folder, do so now: tell Eclipse the external location using "Import/Export...", General-Existing Project into Workspace.如果您没有已成立Eclipse项目,这样$(tomcat.source)是工作区文件夹,现在这样做:告诉Eclipse的外部位置使用“导入/导出...",普通”到工作区现有项目。
Eclipse .project and .classpath files are provided in each of these directories so Eclipse should find all source trees and jars, and hopefully compile without problems.月食。项目。路径文件提供了这些目录之内,以便Eclipse应该找到所有源代码树及瓶子,并希望编译没有问题。 Note that these files assume you are using Eclipse with a 5.0 or later JDK; also, the connectors module must be built with a compiler compliance level of 5.0.请注意,这些文件假设您使用的5.0或更高版本的JDK Eclipse的;此外,连接器模块必须用5.0编译器的遵守程度上。
To run Tomcat without a special IDE plug-in, you can simply use Run-Run...若要运行没有特殊的IDE插件Tomcat的,您可以简单地使用运行“运行... enter "org.apache.catalina.startup.Catalina" as the main class, "start" as program arguments, and "-Dcatalina.home=..."进入“为主要类org.apache.catalina.startup.Catalina”,“启动”的程序参数,和“- Dcatalina.home =..." (with the name of your build directory) as VM arguments. (与您的构建目录名称)VM参数。
Note also that due to the way the Tomcat source is assembled from several SVN projects, you may not be able to use the Eclipse SVN client to update (nor to commit, if you are a committer).另请注意,由于Tomcat的来源是从几个SVN项目的组装方式,您可能无法使用Eclipse SVN客户端更新(或承诺,如果您是提交者)。 Use the external SVN client of your choice, then use the Eclipse PackageExplorer or Navigator "Refresh" context menu item to tell Eclipse that you've updated the files.使用您所选择的外部SVN客户端,然后使用Eclipse PackageExplorer或导航器“刷新”上下文菜单项来告诉Eclipse您已更新的文件。