How to construct string like new String('A', 30) in Java

JaeChul Kim :

I'm studying Java recently.

Is there any way to make a string from char with N-times?

C#: string str = new string('A', 30);

Java: ???

please help me. Thank you

nz_21 :

What version of java are you using?

If Java 8

String.join("", Collections.nCopies(n, s));

If Java 11

"abc".repeat(12);

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Validate a date in a string java (block errors like Feb 30)

construct a unique number for a string in java

construct string with new pointer and reassign to original

How to construct a Date from a String

How to construct an instance of Dictionary<string, List<string>>

how to add record separator (ASCII 30) in java string

Java: Getting the properties of a class to construct a string representation

How to update a string with new value in java?

How can I set the MySQL date with string like 2015-07-30 18:32:18

How to change a string format like 2d30m to timespan?

How to construct a string containing the keys of a map in Terraform?

How to construct properly a html string in C#

How to construct ZonedDateTime from an Instant and a time string?

How to get the byte[] used to construct a String?

How to Construct a String from Data Dictionary in Python?

How to construct a timedelta object from a simple string

how to construct a unique pointer that points to a certain string

How to construct a String instance from a sequence of integers?

How to construct pymongo query string from dictionary

How to construct a Currency Locale from a String?

How to Construct Object from Xml string

How can I construct a string to be read as unicode?

Is there a difference between String[]::new and new String[] in java?

difference between new String[]{} and new String[] in java

How to achieve a multi valued hashmap like HashMap<String,Hashmap<String,String>> in Java

How can I construct a Template String from a regular string?

Java: how to format string with logging-like pattern?

How to convert an XML structured-like object to a JSON string in Java?

How to search string LIKE 'something%' with Java Spring Framework?

TOP Ranking

  1. 1

    Failed to listen on localhost:8000 (reason: Cannot assign requested address)

  2. 2

    Loopback Error: connect ECONNREFUSED 127.0.0.1:3306 (MAMP)

  3. 3

    How to import an asset in swift using Bundle.main.path() in a react-native native module

  4. 4

    pump.io port in URL

  5. 5

    Spring Boot JPA PostgreSQL Web App - Internal Authentication Error

  6. 6

    Can't pre-populate phone number and message body in SMS link on iPhones when SMS app is not running in the background

  7. 7

    Do Idle Snowflake Connections Use Cloud Services Credits?

  8. 8

    maven-jaxb2-plugin cannot generate classes due to two declarations cause a collision in ObjectFactory class

  9. 9

    Binding element 'string' implicitly has an 'any' type

  10. 10

    BigQuery - concatenate ignoring NULL

  11. 11

    Compiler error CS0246 (type or namespace not found) on using Ninject in ASP.NET vNext

  12. 12

    In Skype, how to block "User requests your details"?

  13. 13

    Jquery different data trapped from direct mousedown event and simulation via $(this).trigger('mousedown');

  14. 14

    Pandas - check if dataframe has negative value in any column

  15. 15

    flutter: dropdown item programmatically unselect problem

  16. 16

    Generate random UUIDv4 with Elm

  17. 17

    Is it possible to Redo commits removed by GitHub Desktop's Undo on a Mac?

  18. 18

    ngClass error (Can't bind ngClass since it isn't a known property of div) in Angular 11.0.3

  19. 19

    Change dd-mm-yyyy date format of dataframe date column to yyyy-mm-dd

  20. 20

    EXCEL: Find sum of values in one column with criteria from other column

  21. 21

    How to use merge windows unallocated space into Ubuntu using GParted?

HotTag

Archive