Skip to content
Advertisement

Tag: string

Sort List of Strings arrays in Java

I’m trying to make a program that consists of an array of Strings . now I need to sort them in order ‘PJ’, ‘GHS’, ‘FJ’, ‘PAS’ and date. input : output: //Always ‘PJ’, ‘GHS’, ‘FJ’ then ‘PAS’ Answer You should consider using custom java classes instead of String Array. Find below an example to do it .

How do I split the plus minus number string in java? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago. Improve this question Input : String arrr[] = new String[4]; arrr[0] = +2501 +2502 +2503 +2504 arrr[1] = -2501 -2504 +2505 +2506 +2507 +2509 arrr[2] = +2501 +2511

How can i remove different strings from one string?

I’ve been searching for a while but other answers are quiet different to what im trying to do. I’m trying to delete prepositions from a string but i wonder if there is any way to delete them without doing it one by one like i’m doing right now: (I’m trying to delete spanish prepositions like (de, del, el, la)) Once

How to append in String Builder in java? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago. Improve this question Suppose I have sentence in String X. How can I split each word in sentence and add a span tag for each word with class

How to replace even values in string with ASCII value?

Suppose I have a string as ABCDEFG. I want to replace the even values of this string with their ASCII value. How should I do? Answer You are almost there, you simply need to build the resulting string. Strings are immutable, so replacing would create a new String each time. I would suggest a StringBuilder for this task, but you

How can I split a string without knowing the split characters a-priori?

For my project I have to read various input graphs. Unfortunately, the input edges have not the same format. Some of them are comma-separated, others are tab-separated, etc. For example: File 1: File 2 Rather than handling each case separately, I would like to automatically detect the split characters. Currently I have developed the following solution: Basically I pick the

How do I remove a word that contains a dash from a text?

so I want to remove a word that contains a dash between them like off-campus alongside other things that I want to remove. here is my code so far. so far it prints CS is a wonderful class So WONDERFUL amazing class cleaver class must-remove Answer You could use the regex w+-w+, which means 2 words w+, separated by a

Advertisement