Untitled
unknown
java
3 months ago
1.5 kB
10
Indexable
private static String AbilityFormat(String HTMLcardEffect,String imgPath){
String cssString = """
<style>
.format {
position:absolute;
left: 10%; top: 50%;
color:white;
font-family:arial;
font-size:px40;
width:788px
}
.cardImg {
width:825px;
height:1200px;
background-image: url(
"""+
imgPath
+"""
);
background-repeat: no-repeat;
}
</style>
""";
String HtmlString =String.format("<head>\n%s</head>\n<body>\n<div class=\"cardImg\">\n<p class=\"format\">\n",cssString);
int lastcharpos =0;
int currcharpos = 0;
String htmlParagraph= "";
while (currcharpos < HTMLcardEffect.length()) {
if (HTMLcardEffect.charAt(currcharpos)== '\n'){
htmlParagraph =HTMLcardEffect.substring(lastcharpos, currcharpos)+"<br>\n";
lastcharpos= currcharpos;
HtmlString += htmlParagraph;
}
currcharpos++;
}
return HtmlString + "\n</p>\n</div>\n</body>";
}Editor is loading...
Leave a Comment