HELLO SPIGOT COMMUNITY! So... I have 2 Strings: Code (Text): String label = "&7&l&m----------[&r &6" + str + " &7&l&m]----------"; and String label2 = "&7&l&m"; I want to get the lenght of "label, and for example is 8, i want to add 8 bars to label2 Example: -ThisIsAnExample- (17 charactes) -------------------------- (17 characters) I tried this: Code (Text): String label2 = "&7&l&m"; int lenght = label.length(); for (int i = 0; i < lenght; i++) { label2 = label2 + "-"; } But, this code show the second line more longer than the first Image: http://prntscr.com/b9wnz8 THANKS FOR YOUR TIME! - JOSE
a guy with 4 resources... great work and amazing brain coming to spigot asking for help about java starting stuff.... i am sirsly... thats what happend to me after i got for 1 year and learned around more 6 languages.... if you dont understand strings dude please go to Java Docs and learn the basic stuff of java
Fdz nao é java ! É pseudocódigo por amor de deus para de pedir código pensa e aprende os básicos antes de ires para o java ! A comunidade PT já tem problemas por-causa de estarem sempre a pedir código ou pedir ajuda em coisas sem qualquer nexo ..
You managed to fail basic addition, spelling and loop logic all at once, kind of impressive Just add characters equal to the difference in the string length. Code (Java): int dif = string1.length() - string2.length(); if(dif>0) while(--dif>-1) string2+="-";