我想从字符串中删除所有特殊字符,我尝试了 stackoverflow 中给出的许多选项,但没有一个对我有用。
这是我的代码:
public class convert {
public static void main(String[] args) {
try {
List<List<String>> outerList = new ArrayList<List<String>>();
outerList.add(new ArrayList<String>(asList("11-","2")));
outerList.add(new ArrayList<String>(asList("(2^","1")));
outerList.add(new ArrayList<String>(asList("11","3)")));
int i,j;
for(i=0;i<outerList.size();i++){
for(j=0;j<outerList.get(0).size();j++){
outerList.get(i).get(j).replaceAll("[^\\w\\s]", "");
if(outerList.get(i).get(j).matches("-?\\d+"){
continue;
}else{
System.out.println("special characters not removed");
System.exit(0);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
Run Code Online (Sandbox Code Playgroud) 我是并行流的新手,并试图制作一个计算值*100(1到100)并将其存储在地图中的示例程序.在执行代码时,每次迭代都会有不同的数量.我可能在某个地方错了所以请指导我,任何人都知道正确的方法.
代码:
import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.stream.Collectors;
public class Main{
static int l = 0;
public static void main (String[] args) throws java.lang.Exception {
letsGoParallel();
}
public static int makeSomeMagic(int data) {
l++;
return data * 100;
}
public static void letsGoParallel() {
List<Integer> dataList = new ArrayList<>();
for(int i = 1; i <= 100 ; i++) {
dataList.add(i);
}
Map<Integer, Integer> resultMap = new HashMap<>();
dataList.parallelStream().map(f -> {
Integer xx = 0;
{
xx = …Run Code Online (Sandbox Code Playgroud) 我有jsfiddle演示.
我想显示特定悬停的特定div悬停.我已经制作了功能,它将在悬停时显示div,但它不起作用.
我很困惑,如何为每个标签制作一个功能.现在我只做了一个功能.
代码:
<a class="cart" href="#"> show </a><br>
<a class="cart1" href="#"> show1 </a><br>
<a class="cart2" href="#"> show2 </a><br>
<div class="laptop" style="position: absolute;z-index: 1;">
laptop
</div>
<div class="mobile" style="position: absolute;z-index: 1;">
mobile
</div>
<div class="shoes" style="position: absolute;z-index: 1;">
shoes
</div>
Run Code Online (Sandbox Code Playgroud)
CSS:
.laptop{
display: none;
min-height: 400px;
width: 400px:
position:absolute;
background-color: black;
}
.mobile{
display: none;
min-height: 200px;
width: 200px:
position:absolute;
background-color: blue;
}
.shoes{
display: none;
min-height: 300px;
width: 200px:
position:absolute;
background-color: red;
}
Run Code Online (Sandbox Code Playgroud)
JS:
$(document).ready(function () { …Run Code Online (Sandbox Code Playgroud) 我试图用一个标签在一行中显示2个文本框.
我已经使用了css,但它没有用.
<div class="inq_form_label_prd">
Subject :
</div>
<div class="inq_form_content_prd">
<input type="text" class="inq_txtbox_prd" name="inq_sub_msg">
</div>
<div class="inq_form_label_prd1">
Subject :
</div>
<div class="inq_form_content_prd1">
<input type="text" class="inq_txtbox_prd" name="inq_sub_msg">
</div>
Run Code Online (Sandbox Code Playgroud)
CSS:
.inq_form_label_prd
{
line-height: 28px;
float: left;
width: 120px;
font-weight: bolder;
text-align: right;
padding-right: 10px;
color: #666;
margin-top:5px;
margin-left:0px;
}
.inq_form_content_prd
{
margin-left: 130px;
line-height: 28px;
font-size:12px;
font-weight:bolder;
}
.inq_form_label_prd1
{
line-height: 28px;
float: left;
width: 120px;
font-weight: bolder;
text-align: right;
padding-right: 10px;
color: #666;
margin-top:5px;
margin-left:200px;
}
.inq_form_content_prd1
{
margin-left: 390px;
line-height: …Run Code Online (Sandbox Code Playgroud) 我试图解析字符串浮动但它给了我一些不同的输出.假设我的代码:
String a = "111111111111111111111.23";
Float f = Float.parseFloat(a);
System.out.println(f);
Run Code Online (Sandbox Code Playgroud)
它给了我类似的东西: 1.1111111E20
它以简单的方式给了我 111111110000000000000
如何显示所有数据?我不想截断输入数据.
java ×3
css ×2
html ×1
inline ×1
java-8 ×1
java-stream ×1
javascript ×1
jquery ×1
mouseover ×1
string ×1