Compare commits

..

25 commits
0.8 ... 0.17

Author SHA1 Message Date
c64a76a8ac Upgraded commons-lang3 lib to 3.13.0. 2023-11-27 04:14:18 +01:00
57fd1de666 Removed unuseful code. 2021-10-14 16:43:17 +02:00
376e594328 Build 0.17.0 2021-10-14 15:55:31 +02:00
bce98b5849 Upgraded commons-lang3 from 3.7 to 3.12. 2021-10-14 15:55:07 +02:00
2a9583de78 Upgraded to Java 17. 2021-10-12 19:29:11 +02:00
f78bb92c5f Build 0.11.4 2021-06-07 03:07:40 +02:00
ab69bc620c Added startsWith*, endsWith* and contains* methods in StringsUtils. 2021-06-07 03:06:29 +02:00
0445919fc2 Added containsNone methods. 2021-02-22 01:31:45 +01:00
b2adaba8ba Fixed deprecated code and copyright years. 2021-01-18 19:43:48 +01:00
d186965f7f Build 0.11.3 2021-01-18 19:36:46 +01:00
a4985cb2b8 Added remove methods and unit tests. 2021-01-18 19:36:21 +01:00
8da21c24c8 Build 0.11.2 2021-01-18 07:04:51 +01:00
565af32f0b Improved writeTo utils methods. 2021-01-18 07:04:09 +01:00
905a808aaa Build 0.11.1 2021-01-15 17:44:23 +01:00
54225f84f6 Fixed mistake in list building. 2021-01-15 17:43:34 +01:00
61d913c3e8 Reviewed code. 2020-10-05 15:22:46 +02:00
4aca746ee0 Added isMatching strings by regexps, and tests. 2020-09-29 18:18:36 +02:00
05c1b543fe Upgraded README file. 2020-09-13 01:11:09 +02:00
c497501bc6 Fixed NullPointerException with IllegalArgumentException. 2020-09-13 00:46:44 +02:00
016eab3417 Updated some copyright year references. 2020-09-13 00:42:43 +02:00
8a56a70946 Build 0.11.0 2020-09-08 17:40:46 +02:00
f9c9760608 Upgraded minor version to 11 for Java migration. 2020-09-08 17:36:03 +02:00
0658c685a1 Upgrade minor version to 11 as symbolic step to Java 11. 2020-08-24 15:39:31 +02:00
56085f105b Added filter and count methods, and test code about. 2020-08-15 03:34:23 +02:00
fbb55f8a7f Migrated to Eclipse 4.16 and Java 11. 2020-08-14 01:15:35 +02:00
21 changed files with 1981 additions and 118 deletions

View file

@ -2,16 +2,16 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="lib" path="lib/UnitTesting/hamcrest-core-1.3.jar" sourcepath="lib/UnitTesting/hamcrest-core-1.3-sources.jar"/>
<classpathentry kind="lib" path="lib/Logs/log4j-1.2.17.jar" sourcepath="lib/Logs/log4j-1.2.17-source.zip"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/java-17-openjdk-amd64">
<attributes>
<attribute name="owner.project.facets" value="java"/>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="lib/commons-lang3-3.7.jar" sourcepath="lib/commons-lang3-3.7-sources.jar"/>
<classpathentry kind="lib" path="lib/UnitTesting/hamcrest-core-1.3.jar" sourcepath="lib/UnitTesting/hamcrest-core-1.3-sources.jar"/>
<classpathentry kind="lib" path="lib/Logs/log4j-1.2.17.jar" sourcepath="lib/Logs/log4j-1.2.17-source.zip"/>
<classpathentry kind="lib" path="lib/UnitTesting/junit-4.12.jar" sourcepath="lib/UnitTesting/junit-4.12-sources.jar"/>
<classpathentry kind="lib" path="lib/Logs/slf4j-api-1.7.25.jar" sourcepath="lib/Logs/slf4j-api-1.7.25-sources.jar"/>
<classpathentry kind="lib" path="lib/Logs/slf4j-log4j12-1.7.25.jar" sourcepath="lib/Logs/slf4j-log4j12-1.7.25-sources.jar"/>
<classpathentry kind="lib" path="lib/commons-lang3-3.13.0.jar" sourcepath="lib/commons-lang3-3.13.0-sources.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -11,16 +11,24 @@ org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=17
org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false
org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns=false
org.eclipse.jdt.core.formatter.align_with_spaces=false
org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
@ -28,25 +36,41 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain=0
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=49
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0
org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_module_statements=16
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16
org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_record_components=16
org.eclipse.jdt.core.formatter.alignment_for_relational_operator=0
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_shift_operator=0
org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_record_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0
org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0
org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration=0
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method=1
org.eclipse.jdt.core.formatter.blank_lines_before_field=0
org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
@ -55,6 +79,7 @@ org.eclipse.jdt.core.formatter.blank_lines_before_method=1
org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
org.eclipse.jdt.core.formatter.blank_lines_before_package=0
org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
org.eclipse.jdt.core.formatter.blank_lines_between_statement_group_in_switch=0
org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=next_line
org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=next_line
@ -64,11 +89,17 @@ org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=next_line
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=next_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=next_line
org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line
org.eclipse.jdt.core.formatter.brace_position_for_record_constructor=next_line
org.eclipse.jdt.core.formatter.brace_position_for_record_declaration=next_line
org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line
org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=false
org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=false
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=false
org.eclipse.jdt.core.formatter.comment.format_block_comments=false
org.eclipse.jdt.core.formatter.comment.format_header=false
org.eclipse.jdt.core.formatter.comment.format_html=true
@ -77,9 +108,11 @@ org.eclipse.jdt.core.formatter.comment.format_line_comments=true
org.eclipse.jdt.core.formatter.comment.format_source_code=true
org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
org.eclipse.jdt.core.formatter.comment.indent_tag_description=false
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags=do not insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
org.eclipse.jdt.core.formatter.comment.line_length=80
org.eclipse.jdt.core.formatter.comment.line_length=120
org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
@ -93,6 +126,7 @@ org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_record_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=false
org.eclipse.jdt.core.formatter.indent_empty_lines=false
@ -101,6 +135,7 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
org.eclipse.jdt.core.formatter.indentation.size=4
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
@ -109,6 +144,7 @@ org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
@ -122,11 +158,14 @@ org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case=insert
org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
@ -152,10 +191,16 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arg
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_record_components=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_not_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
@ -172,6 +217,7 @@ org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not ins
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_record_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
@ -180,13 +226,19 @@ org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert
org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
@ -203,6 +255,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not in
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_record_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
@ -229,10 +282,15 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_ar
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_record_components=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
@ -244,6 +302,8 @@ org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_constructor=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
@ -259,6 +319,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_record_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
@ -269,9 +330,12 @@ org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not inser
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
@ -283,20 +347,62 @@ org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_decla
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.join_lines_in_comments=true
org.eclipse.jdt.core.formatter.join_wrapped_lines=true
org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_code_block_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_method_body_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_record_constructor_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_record_declaration_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line=false
org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line=false
org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line=false
org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line=false
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.lineSplit=200
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block=0
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block=0
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block=0
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body=0
org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block=0
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_record_declaration=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.text_block_indentation=0
org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true
org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false
org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true
org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true
org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true
org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
org.eclipse.jdt.core.formatter.wrap_before_relational_operator=true
org.eclipse.jdt.core.formatter.wrap_before_shift_operator=true
org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter

View file

@ -13,28 +13,36 @@ cleanup.always_use_this_for_non_static_field_access=true
cleanup.always_use_this_for_non_static_method_access=false
cleanup.convert_functional_interfaces=false
cleanup.convert_to_enhanced_for_loop=false
cleanup.convert_to_enhanced_for_loop_if_loop_var_used=false
cleanup.correct_indentation=false
cleanup.format_source_code=true
cleanup.format_source_code_changes_only=false
cleanup.insert_inferred_type_arguments=false
cleanup.lazy_logical_operator=false
cleanup.make_local_variable_final=false
cleanup.make_parameters_final=true
cleanup.make_private_fields_final=false
cleanup.make_type_abstract_if_missing_method=false
cleanup.make_variable_declarations_final=true
cleanup.merge_conditional_blocks=false
cleanup.never_use_blocks=false
cleanup.never_use_parentheses_in_expressions=true
cleanup.number_suffix=false
cleanup.organize_imports=false
cleanup.push_down_negation=false
cleanup.qualify_static_field_accesses_with_declaring_class=false
cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
cleanup.qualify_static_member_accesses_with_declaring_class=true
cleanup.qualify_static_method_accesses_with_declaring_class=false
cleanup.remove_private_constructors=true
cleanup.remove_redundant_modifiers=false
cleanup.remove_redundant_semicolons=false
cleanup.remove_redundant_type_arguments=false
cleanup.remove_trailing_whitespaces=true
cleanup.remove_trailing_whitespaces_all=true
cleanup.remove_trailing_whitespaces_ignore_empty=false
cleanup.remove_unnecessary_array_creation=false
cleanup.remove_unnecessary_casts=true
cleanup.remove_unnecessary_nls_tags=true
cleanup.remove_unused_imports=true
@ -43,24 +51,30 @@ cleanup.remove_unused_private_fields=true
cleanup.remove_unused_private_members=false
cleanup.remove_unused_private_methods=true
cleanup.remove_unused_private_types=true
cleanup.simplify_lambda_expression_and_method_ref=false
cleanup.sort_members=true
cleanup.sort_members_all=false
cleanup.use_anonymous_class_creation=false
cleanup.use_autoboxing=false
cleanup.use_blocks=true
cleanup.use_blocks_only_for_return_and_throw=false
cleanup.use_directly_map_method=false
cleanup.use_lambda=true
cleanup.use_parentheses_in_expressions=false
cleanup.use_this_for_non_static_field_access=true
cleanup.use_this_for_non_static_field_access_only_if_necessary=false
cleanup.use_this_for_non_static_method_access=false
cleanup.use_this_for_non_static_method_access_only_if_necessary=true
cleanup.use_unboxing=false
cleanup.use_var=false
cleanup_profile=_Devinsy-strings
cleanup_settings_version=2
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=_Devinsy-strings
formatter_settings_version=12
formatter_settings_version=19
jautodoc.cleanup.add_header=false
jautodoc.cleanup.javadoc=false
jautodoc.cleanup.replace_header=false
org.eclipse.jdt.ui.exception.name=exception
org.eclipse.jdt.ui.gettersetter.use.is=true

View file

@ -3,5 +3,5 @@
<fixed facet="jst.java"/>
<fixed facet="jst.utility"/>
<installed facet="jst.utility" version="1.0"/>
<installed facet="jst.java" version="1.8"/>
<installed facet="jst.java" version="17"/>
</faceted-project>

View file

@ -13,8 +13,8 @@ This software is released under the GNU LGPL.
## Requirements
- Java 1.6
- Eclipse Kepler
- Java 11
- Eclipse 4.16 (202006).
## Context
Several useful Java classes.

View file

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
#Mon Jun 04 09:18:36 CEST 2018
build.number=3
#Thu Oct 14 15:55:30 CEST 2021
build.number=1

View file

@ -1,3 +1,3 @@
product.name=devinsy-strings
product.revision.major=0
product.revision.minor=8
product.revision.minor=17

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2008-2010,2013-2015,2017-2018 Christian Pierre MOMON
* Copyright (C) 2008-2021 Christian Pierre MOMON
*
* This file is part of Devinsy-strings.
*
@ -25,14 +25,15 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
/**
* The <code>StringList</code> class is a collection of String objects with
* specific methods. It makes possible to build a string without any copy. The
* goal is to optimize the building of strings where they are lot of
* concatenation action.
* The <code>StringList</code> class is a collection of String objects with specific methods. It makes possible to build
* a string without any copy. The goal is to optimize the building of strings where they are lot of concatenation
* action.
*
*/
public class StringList extends ArrayList<String> implements CharSequence, Appendable
@ -42,8 +43,7 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
public static final String LINE_SEPARATOR = "\n";
/**
* Constructs an empty list with an initial capacity of ten (see ArrayList
* constructor).
* Constructs an empty list with an initial capacity of ten (see ArrayList constructor).
*/
public StringList()
{
@ -93,8 +93,8 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
}
/**
* Constructs a list of string of the specified collection, in the order they
* are returned by the collection's iterator.
* Constructs a list of string of the specified collection, in the order they are returned by the collection's
* iterator.
*
* @param source
* the source
@ -336,8 +336,7 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
}
/**
* Appends the string of the specified collection, in the order they are
* returned by the collection's iterator.
* Appends the string of the specified collection, in the order they are returned by the collection's iterator.
*
* @param strings
* the strings
@ -541,8 +540,7 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
}
/**
* Appends the string representation of the char argument to this string list,
* then append a break line too.
* Appends the string representation of the char argument to this string list, then append a break line too.
*
* @param character
* the character
@ -559,8 +557,8 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
}
/**
* Appends the string of the specified collection, in the order they are
* returned by the collection's iterator. Then append a return line.
* Appends the string of the specified collection, in the order they are returned by the collection's iterator. Then
* append a return line.
*
* @param string
* the string
@ -1142,6 +1140,144 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
return result;
}
/**
* Count blank strings.
*
* @return the blank string count.
*/
public int countBlankStrings()
{
int result;
result = 0;
for (String string : this)
{
if (StringUtils.isBlank(string))
{
result += 1;
}
}
//
return result;
}
/**
* Count not blank strings.
*
* @return the not blank string count.
*/
public int countNotBlankStrings()
{
int result;
result = 0;
for (String string : this)
{
if (StringUtils.isNotBlank(string))
{
result += 1;
}
}
//
return result;
}
/**
* Count strings matching a regex.
*
* @param regex
* the regex
* @return the string count matching the regex.
*/
public int countStrings(final String regex)
{
int result;
result = 0;
if (regex != null)
{
Pattern compiledPattern = Pattern.compile(regex);
for (String string : this)
{
if (string != null)
{
Matcher matcher = compiledPattern.matcher(string);
if (matcher.matches())
{
result += 1;
}
}
}
}
//
return result;
}
/**
* Filter the strings matching a regex.
*
* @param regex
* the regex to match.
* @return the string list matching the regex
*/
public StringList filter(final String regex)
{
StringList result;
result = new StringList(this.size());
if (regex != null)
{
Pattern compiledPattern = Pattern.compile(regex);
for (String string : this)
{
if (string != null)
{
Matcher matcher = compiledPattern.matcher(string);
if (matcher.matches())
{
result.add(string);
}
}
}
}
result.trimToSize();
//
return result;
}
/**
* Filter blank strings.
*
* @return the not Blank string list
*/
public StringList filterBlankStrings()
{
StringList result;
result = new StringList(this.size());
for (String string : this)
{
if (StringUtils.isNotBlank(string))
{
result.add(string);
}
}
//
return result;
}
/**
* Gets the by index.
*
@ -1589,8 +1725,7 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
}
/**
* Returns the length of the string list concatenation. Null strings are
* ignored.
* Returns the length of the string list concatenation. Null strings are ignored.
*
* @return the int
*/
@ -1612,8 +1747,8 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
}
/**
* Merge all strings of the list into in single string. At the end of operation,
* the new string is the first of the list and the size list is 1.
* Merge all strings of the list into in single string. At the end of operation, the new string is the first of the
* list and the size list is 1.
*
* @return the string list
*/
@ -1632,6 +1767,59 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
return result;
}
/**
* Removes the first.
*
* @return the string list
*/
public StringList removeFirst()
{
StringList result;
if (!isEmpty())
{
this.remove(0);
}
result = this;
//
return result;
}
/**
* Removes the first.
*
* @param count
* the count
* @return the string list
*/
public StringList removeFirst(final int count)
{
StringList result;
int counting;
if (count < 0)
{
counting = 0;
}
else if (count <= size())
{
counting = count;
}
else
{
counting = size();
}
removeRange(0, counting);
result = this;
//
return result;
}
/**
* Removes the last element of the list.
*
@ -1641,7 +1829,7 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
{
StringList result;
if (this.size() > 0)
if (!isEmpty())
{
this.remove(this.size() - 1);
}
@ -1652,6 +1840,47 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
return result;
}
/**
* Removes the last.
*
* @param count
* the count
* @return the string list
*/
public StringList removeLast(final int count)
{
StringList result;
int counting;
if (count < 0)
{
counting = 0;
}
else
{
counting = count;
}
boolean ended = false;
while (!ended)
{
if ((counting == 0) || (isEmpty()))
{
ended = true;
}
else
{
this.remove(this.size() - 1);
counting -= 1;
}
}
result = this;
//
return result;
}
/**
* Extends the list copying the last element a number of time.
*
@ -1929,7 +2158,7 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
buffer.append(separator);
}
if (separator != null)
if ((separator != null) && (!isEmpty()))
{
buffer.removeLast();
}
@ -1943,8 +2172,7 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
}
/**
* Returns an array containing all of the strings in this list in proper
* sequence (from first to last element).
* Returns an array containing all of the strings in this list in proper sequence (from first to last element).
*
* @return the string[]
*/
@ -1964,9 +2192,8 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
}
/**
* Returns a string containing the concatenation of the strings of this list.
* Between each string of this list, a separator argument string is concatenated
* too.
* Returns a string containing the concatenation of the strings of this list. Between each string of this list, a
* separator argument string is concatenated too.
*
* @param separator
* the separator
@ -1990,9 +2217,8 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
}
/**
* Returns a string containing the concatenation of the strings of this list.
* Between each string of this list, a separator argument string is concatenated
* too.
* Returns a string containing the concatenation of the strings of this list. Between each string of this list, a
* separator argument string is concatenated too.
*
* @param separator
* the separator

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2013-2015,2017-2018 Christian Pierre MOMON
* Copyright (C) 2013-2020 Christian Pierre MOMON
*
* This file is part of Devinsy-strings.
*
@ -57,7 +57,7 @@ public class StringListInputStream extends InputStream
{
if (source == null)
{
throw new NullPointerException("source is null.");
throw new IllegalArgumentException("source is null.");
}
else
{

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2013-2018 Christian Pierre MOMON
* Copyright (C) 2013-2021 Christian Pierre MOMON
*
* This file is part of Devinsy-strings.
*
@ -18,7 +18,6 @@
*/
package fr.devinsy.strings;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.Reader;
@ -60,8 +59,6 @@ public class StringListReader extends Reader
{
int result;
BufferedReader a;
if ((off < 0) || (off > cbuf.length) || (len < 0) || ((off + len) > cbuf.length) || ((off + len) < 0))
{
throw new IndexOutOfBoundsException();

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2013-2018 Christian Pierre MOMON
* Copyright (C) 2013-2020 Christian Pierre MOMON
*
* This file is part of Devinsy-strings.
*
@ -57,7 +57,7 @@ public class StringListWriter extends Writer
{
if (target == null)
{
throw new NullPointerException("target is null.");
throw new IllegalArgumentException("target is null.");
}
else
{

View file

@ -22,9 +22,8 @@ import java.util.Collection;
import java.util.HashSet;
/**
* This class is a set of String objects with specific methods. It makes
* possible to build a string without any copy. The goal is to make easier the
* use of set of strings.
* This class is a set of String objects with specific methods. It makes possible to build a string without any copy.
* The goal is to make easier the use of set of strings.
*/
public class StringSet extends HashSet<String>
{
@ -39,8 +38,8 @@ public class StringSet extends HashSet<String>
}
/**
* Constructs a list of string of the specified collection, in the order they
* are returned by the collection's iterator.
* Constructs a list of string of the specified collection, in the order they are returned by the collection's
* iterator.
*
* @param source
* the source
@ -82,7 +81,6 @@ public class StringSet extends HashSet<String>
if (source != null)
{
//
for (String string : source)
{
this.add(string);
@ -102,7 +100,6 @@ public class StringSet extends HashSet<String>
if (source != null)
{
//
for (String string : source)
{
this.add(string);
@ -122,15 +119,13 @@ public class StringSet extends HashSet<String>
{
boolean result;
if (string != null)
if (string == null)
{
//
result = super.add(string);
result = false;
}
else
{
//
result = false;
result = super.add(string);
}
//

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2008-2010,2013-2016,2017-2018 Christian Pierre MOMON
* Copyright (C) 2008-2020 Christian Pierre MOMON
*
* This file is part of Devinsy-strings.
*
@ -151,6 +151,12 @@ public class StringsUtils
{
boolean result;
if ((token == null) || (strings == null))
{
result = false;
}
else
{
boolean ended = false;
int index = 0;
result = false;
@ -176,6 +182,57 @@ public class StringsUtils
result = false;
}
}
}
//
return result;
}
/**
* Contains any.
*
* @param token
* the token
* @param strings
* the strings
* @return true, if successful
*/
public static boolean containsAny(final String token, final StringList strings)
{
boolean result;
if ((token == null) || (strings == null))
{
result = false;
}
else
{
boolean ended = false;
int index = 0;
result = false;
while (!ended)
{
if (index < strings.size())
{
String current = strings.get(index);
if (StringUtils.contains(token, current))
{
ended = true;
result = true;
}
else
{
index += 1;
}
}
else
{
ended = true;
result = false;
}
}
}
//
return result;
@ -194,6 +251,12 @@ public class StringsUtils
{
boolean result;
if ((token == null) || (strings == null))
{
result = false;
}
else
{
boolean ended = false;
int index = 0;
result = false;
@ -219,6 +282,57 @@ public class StringsUtils
result = false;
}
}
}
//
return result;
}
/**
* Contains any ignore case.
*
* @param token
* the token
* @param strings
* the strings
* @return true, if successful
*/
public static boolean containsAnyIgnoreCase(final String token, final StringList strings)
{
boolean result;
if ((token == null) || (strings == null))
{
result = false;
}
else
{
boolean ended = false;
int index = 0;
result = false;
while (!ended)
{
if (index < strings.size())
{
String current = strings.get(index);
if (StringUtils.containsIgnoreCase(token, current))
{
ended = true;
result = true;
}
else
{
index += 1;
}
}
else
{
ended = true;
result = false;
}
}
}
//
return result;
@ -328,6 +442,44 @@ public class StringsUtils
return result;
}
/**
* Contains none.
*
* @param token
* the token
* @param strings
* the strings
* @return true, if successful
*/
public static boolean containsNone(final String token, final String... strings)
{
boolean result;
result = !containsAny(token, strings);
//
return result;
}
/**
* Contains none ignore case.
*
* @param token
* the token
* @param strings
* the strings
* @return true, if successful
*/
public static boolean containsNoneIgnoreCase(final String token, final String... strings)
{
boolean result;
result = !containsAnyIgnoreCase(token, strings);
//
return result;
}
/**
* Contains null.
*
@ -380,6 +532,179 @@ public class StringsUtils
return result;
}
/**
* Count blank strings.
*
* @param source
* the string list to compute.
* @return the blank string count.
*/
public static int countBlankStrings(final StringList source)
{
int result;
if (source == null)
{
result = 0;
}
else
{
result = source.countBlankStrings();
}
//
return result;
}
/**
* Count not blank strings.
*
* @param source
* the string list to compute.
* @return the not blank string count.
*/
public static int countNotBlankStrings(final StringList source)
{
int result;
if (source == null)
{
result = 0;
}
else
{
result = source.countNotBlankStrings();
}
//
return result;
}
/**
* Count strings matching a regex.
*
* @param source
* the string list to compute
* @param regex
* the regex
* @return the string count matching the regex.
*/
public static int countStrings(final StringList source, final String regex)
{
int result;
if (source == null)
{
result = 0;
}
else
{
result = source.countStrings(regex);
}
//
return result;
}
/**
* Ends with any.
*
* @param token
* the token
* @param strings
* the strings
* @return true, if successful
*/
public static boolean endsWithAny(final String token, final StringList strings)
{
boolean result;
if ((token == null) || (strings == null))
{
result = false;
}
else
{
boolean ended = false;
int index = 0;
result = false;
while (!ended)
{
if (index < strings.size())
{
String current = strings.get(index);
if (StringUtils.endsWith(token, current))
{
ended = true;
result = true;
}
else
{
index += 1;
}
}
else
{
ended = true;
result = false;
}
}
}
//
return result;
}
/**
* Ends with any ignore case.
*
* @param token
* the token
* @param strings
* the strings
* @return true, if successful
*/
public static boolean endsWithAnyIgnoreCase(final String token, final StringList strings)
{
boolean result;
if ((token == null) || (strings == null))
{
result = false;
}
else
{
boolean ended = false;
int index = 0;
result = false;
while (!ended)
{
if (index < strings.size())
{
String current = strings.get(index);
if (StringUtils.endsWithIgnoreCase(token, current))
{
ended = true;
result = true;
}
else
{
index += 1;
}
}
else
{
ended = true;
result = false;
}
}
}
//
return result;
}
/**
* Checks if is contained.
*
@ -418,6 +743,56 @@ public class StringsUtils
return result;
}
/**
* Filter the strings matching a regex.
*
* @param source
* the string list to compute.
* @param regex
* the regex to match.
* @return the string list matching the regex
*/
public static StringList filter(final StringList source, final String regex)
{
StringList result;
if (source == null)
{
result = new StringList();
}
else
{
result = source.filter(regex);
}
//
return result;
}
/**
* Filter blank strings.
*
* @param source
* the string list to compute.
* @return the not Blank string list
*/
public static StringList filterBlankStrings(final StringList source)
{
StringList result;
if (source == null)
{
result = new StringList();
}
else
{
result = source.filterBlankStrings();
}
//
return result;
}
/**
* Find longest.
*
@ -748,6 +1123,88 @@ public class StringsUtils
return result;
}
/**
* Checks if is matching.
*
* @param args
* the args
* @param regexps
* the regexps
* @return true, if is matching
*/
public static boolean isMatching(final String[] args, final String... regexps)
{
boolean result;
result = isMatching(new StringList(args), regexps);
//
return result;
}
/**
* Checks if is matching.
*
* @param args
* the args
* @param regexps
* the regexps
* @return true, if is matching
*/
public static boolean isMatching(final StringList args, final String... regexps)
{
boolean result;
if (((args == null) || (args.size() == 0)) && ((regexps == null) || (regexps.length == 0)))
{
result = true;
}
else if (((args == null) || (args.size() == 0)) && ((regexps != null) && (regexps.length != 0)))
{
result = false;
}
else if (((args != null) && (args.size() != 0)) && ((regexps == null) || (regexps.length == 0)))
{
result = false;
}
else if (args.size() != regexps.length)
{
result = false;
}
else
{
boolean ended = false;
int index = 0;
result = false;
while (!ended)
{
if (index < args.size())
{
String arg = args.get(index);
String regexp = regexps[index];
if (arg.matches(regexp))
{
index += 1;
}
else
{
ended = true;
result = false;
}
}
else
{
ended = true;
result = true;
}
}
}
//
return result;
}
/**
* Load.
*
@ -945,7 +1402,7 @@ public class StringsUtils
}
/**
* Save.
* Save string of the list as lines.
*
* @param file
* the file
@ -994,6 +1451,106 @@ public class StringsUtils
}
}
/**
* Starts with any.
*
* @param token
* the token
* @param strings
* the strings
* @return true, if successful
*/
public static boolean startsWithAny(final String token, final StringList strings)
{
boolean result;
if ((token == null) || (strings == null))
{
result = false;
}
else
{
boolean ended = false;
int index = 0;
result = false;
while (!ended)
{
if (index < strings.size())
{
String current = strings.get(index);
if (StringUtils.startsWith(token, current))
{
ended = true;
result = true;
}
else
{
index += 1;
}
}
else
{
ended = true;
result = false;
}
}
}
//
return result;
}
/**
* Starts with any ignore case.
*
* @param token
* the token
* @param strings
* the strings
* @return true, if successful
*/
public static boolean startsWithAnyIgnoreCase(final String token, final StringList strings)
{
boolean result;
if ((token == null) || (strings == null))
{
result = false;
}
else
{
boolean ended = false;
int index = 0;
result = false;
while (!ended)
{
if (index < strings.size())
{
String current = strings.get(index);
if (StringUtils.startsWithIgnoreCase(token, current))
{
ended = true;
result = true;
}
else
{
index += 1;
}
}
else
{
ended = true;
result = false;
}
}
}
//
return result;
}
/**
* Swap case.
*
@ -1428,8 +1985,8 @@ public class StringsUtils
*
* @param source
* the source
* @return If argument is null then returns an empty string, otherwise returns a
* string concatenation of the argument.
* @return If argument is null then returns an empty string, otherwise returns a string concatenation of the
* argument.
*/
public static String toStringNotNull(final String[] source)
{
@ -1976,7 +2533,7 @@ public class StringsUtils
* @throws IOException
* Signals that an I/O exception has occurred.
*/
public static void writeTo(final StringList source, final java.io.PrintWriter out) throws IOException
public static void writeTo(final java.io.PrintWriter out, final StringList source) throws IOException
{
if (source != null)
{
@ -1997,7 +2554,7 @@ public class StringsUtils
* @throws IOException
* Signals that an I/O exception has occurred.
*/
public static void writeTo(final StringList source, final java.io.Writer out) throws IOException
public static void writeTo(final java.io.Writer out, final StringList source) throws IOException
{
if (source != null)
{
@ -2007,4 +2564,40 @@ public class StringsUtils
}
}
}
/**
* Save.
*
* @param file
* the file
* @param source
* the source
* @throws UnsupportedEncodingException
* the unsupported encoding exception
* @throws FileNotFoundException
* the file not found exception
*/
public static void writeToFile(final File file, final StringList source) throws UnsupportedEncodingException, FileNotFoundException
{
PrintWriter out = null;
try
{
out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(file), DEFAULT_CHARSET_NAME));
if (source != null)
{
for (String string : source)
{
out.print(string);
}
}
}
finally
{
if (out != null)
{
out.close();
}
}
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2018 Christian Pierre MOMON
* Copyright (C) 2017-2021 Christian Pierre MOMON
*
* This file is part of Devinsy-strings.
*
@ -58,14 +58,14 @@ public class StringsDemo
strings.appendln("========== DEMO #2;");
strings.appendln();
strings.appendln("Easy to concatenate different types.");
strings.append("Boolean: ").append(true).append(" ").appendln(new Boolean(false));
strings.append("Char: ").append('e').append(" ").appendln(new Character('e'));
strings.append("Byte : ").append((byte) 5).append(" ").appendln(new Byte((byte) 5));
strings.append("Short: ").append((short) 55).append(" ").appendln(new Short((short) 55));
strings.append("Integer: ").append(555).append(" ").appendln(new Integer(555));
strings.append("Long: ").append(5555L).append(" ").appendln(new Long(5555));
strings.append("Float: ").append((float) 5555.5).append(" ").appendln(new Float(5555.5));
strings.append("Double: ").append(5555.55).append(" ").appendln(new Double(5555.55));
strings.append("Boolean: ").append(true).append(" ").appendln(Boolean.valueOf(false));
strings.append("Char: ").append('e').append(" ").appendln(Character.valueOf('e'));
strings.append("Byte : ").append((byte) 5).append(" ").appendln(Byte.valueOf((byte) 5));
strings.append("Short: ").append((short) 55).append(" ").appendln(Short.valueOf((short) 55));
strings.append("Integer: ").append(555).append(" ").appendln(Integer.valueOf(555));
strings.append("Long: ").append(5555L).append(" ").appendln(Long.valueOf(5555));
strings.append("Float: ").append((float) 5555.5).append(" ").appendln(Float.valueOf((float) 5555.5));
strings.append("Double: ").append(5555.55).append(" ").appendln(Double.valueOf(5555.55));
strings.append("String: ").append("abcde").append(" ").appendln(new String("abcde"));
strings.append("Object: ").appendln(new Date());
strings.append("Array of booleans: ").appendln(StringsUtils.toStringList(new boolean[] { true, false, true }));
@ -109,7 +109,7 @@ public class StringsDemo
strings.appendln("========== DEMO #4;");
strings.appendln();
strings.appendln("Advanced features.");
strings.append("Boolean: ").append(true).append(" ").appendln(new Boolean(false));
strings.append("Boolean: ").append(true).append(" ").appendln(Boolean.valueOf(false));
System.out.println(strings.toString());
}
@ -121,7 +121,7 @@ public class StringsDemo
strings.appendln("========== DEMO #5;");
strings.appendln();
strings.appendln("Funny features.");
strings.append("Boolean: ").append(true).append(" ").appendln(new Boolean(false));
strings.append("Boolean: ").append(true).append(" ").appendln(Boolean.valueOf(false));
System.out.println(strings.toString());
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2013,2014,2017-2018 Christian Pierre MOMON
* Copyright (C) 2013-2021 Christian Pierre MOMON
*
* This file is part of Devinsy-strings.
*
@ -520,6 +520,225 @@ public class StringListTest
this.logger.debug("===== test done.");
}
/**
* Test count blank strings.
*/
@Test
public void testCountBlankStrings()
{
//
this.logger.debug("===== test starting...");
{
StringList source = new StringList();
Assert.assertEquals(0, source.countBlankStrings());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(0, source.countBlankStrings());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(2, source.countBlankStrings());
}
//
this.logger.debug("===== test done.");
}
/**
* Test count blank strings.
*/
@Test
public void testCountNotBlankStrings()
{
//
this.logger.debug("===== test starting...");
{
StringList source = new StringList();
Assert.assertEquals(0, source.countNotBlankStrings());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(5, source.countNotBlankStrings());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(3, source.countNotBlankStrings());
}
//
this.logger.debug("===== test done.");
}
/**
* Test count strings.
*/
@Test
public void testCountStrings()
{
//
this.logger.debug("===== test starting...");
{
StringList source = new StringList();
Assert.assertEquals(0, source.countStrings(null));
}
{
StringList source = new StringList();
Assert.assertEquals(0, source.countStrings("a*"));
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(0, source.countStrings(null));
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(5, source.countStrings(".*\\d.*"));
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(0, source.countStrings(null));
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(3, source.countStrings(".*\\d.*"));
}
//
this.logger.debug("===== test done.");
}
/**
* Test filter.
*/
@Test
public void testFilter()
{
//
this.logger.debug("===== test starting...");
{
StringList source = new StringList();
Assert.assertEquals(0, source.filter(null).size());
}
{
StringList source = new StringList();
Assert.assertEquals(0, source.filter("a*").size());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(0, source.filter(null).size());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(5, source.filter(".*\\d.*").size());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(0, source.filter(null).size());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(3, source.filter(".*\\d.*").size());
}
//
this.logger.debug("===== test done.");
}
/**
* Test filter blank strings.
*/
@Test
public void testFilterBlankStrings()
{
//
this.logger.debug("===== test starting...");
{
StringList source = new StringList();
Assert.assertEquals(0, source.filterBlankStrings().size());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(5, source.filterBlankStrings().size());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(3, source.filterBlankStrings().size());
}
//
this.logger.debug("===== test done.");
}
/**
* Test iterator of char 01.
*/
@ -556,6 +775,264 @@ public class StringListTest
this.logger.debug("===== test done.");
}
/**
* Test remove first 01.
*/
@Test
public void testRemoveFirst01()
{
StringList source = new StringList();
source.removeFirst();
Assert.assertTrue(source.isEmpty());
}
/**
* Test remove first 02.
*/
@Test
public void testRemoveFirst02()
{
StringList source = new StringList();
source.append("un");
source.removeFirst();
Assert.assertTrue(source.isEmpty());
}
/**
* Test remove first 03.
*/
@Test
public void testRemoveFirst03()
{
StringList source = new StringList();
source.append("un", "deux");
source.removeFirst();
Assert.assertEquals(1, source.size());
Assert.assertEquals("deux", source.getLast());
}
/**
* Test remove first with count 01.
*/
@Test
public void testRemoveFirstWithCount01()
{
StringList source = new StringList();
source.removeFirst(-10);
Assert.assertTrue(source.isEmpty());
source.removeFirst(-1);
Assert.assertTrue(source.isEmpty());
}
@Test
public void testRemoveFirstWithCount02()
{
StringList source = new StringList();
source.append("un", "deux", "trois");
source.removeFirst(-10);
Assert.assertEquals(3, source.size());
source.removeFirst(-1);
Assert.assertEquals(3, source.size());
}
/**
* Test remove first with count 03.
*/
@Test
public void testRemoveFirstWithCount03()
{
StringList source = new StringList();
source.removeFirst(0);
Assert.assertTrue(source.isEmpty());
}
/**
* Test remove first with count 04.
*/
@Test
public void testRemoveFirstWithCount04()
{
StringList source = new StringList();
source.append("un", "deux", "trois");
source.removeFirst(0);
Assert.assertEquals(3, source.size());
}
/**
* Test remove first with count 05.
*/
@Test
public void testRemoveFirstWithCount05()
{
StringList source = new StringList();
source.removeFirst(1);
Assert.assertTrue(source.isEmpty());
source.removeFirst(10);
Assert.assertTrue(source.isEmpty());
}
/**
* Test remove first with count 06.
*/
@Test
public void testRemoveFirstWithCount06()
{
StringList source = new StringList();
source.append("un", "deux", "trois", "quatre", "cinq");
source.removeFirst(1);
Assert.assertEquals(4, source.size());
source.append("cinq", "six", "sept", "huit", "neuf", "dix");
source.removeFirst(10);
Assert.assertTrue(source.isEmpty());
}
/**
* Test remove last 01.
*/
@Test
public void testRemoveLast01()
{
StringList source = new StringList();
source.removeLast();
Assert.assertTrue(source.isEmpty());
}
/**
* Test remove last 02.
*/
@Test
public void testRemoveLast02()
{
StringList source = new StringList();
source.append("un");
source.removeLast();
Assert.assertTrue(source.isEmpty());
}
/**
* Test remove last 02.
*/
@Test
public void testRemoveLast03()
{
StringList source = new StringList();
source.append("un", "deux");
source.removeLast();
Assert.assertEquals(1, source.size());
Assert.assertEquals("un", source.getLast());
}
/**
* Test remove last with count 01.
*/
@Test
public void testRemoveLastWithCount01()
{
StringList source = new StringList();
source.removeLast(-10);
Assert.assertTrue(source.isEmpty());
source.removeLast(-1);
Assert.assertTrue(source.isEmpty());
}
/**
* Test remove last with count 02.
*/
@Test
public void testRemoveLastWithCount02()
{
StringList source = new StringList();
source.append("un", "deux", "trois");
source.removeLast(-10);
Assert.assertEquals(3, source.size());
source.removeLast(-1);
Assert.assertEquals(3, source.size());
}
/**
* Test remove last with count 03.
*/
@Test
public void testRemoveLastWithCount03()
{
StringList source = new StringList();
source.removeLast(0);
Assert.assertTrue(source.isEmpty());
}
/**
* Test remove last with count 04.
*/
@Test
public void testRemoveLastWithCount04()
{
StringList source = new StringList();
source.append("un", "deux", "trois");
source.removeLast(0);
Assert.assertEquals(3, source.size());
}
/**
* Test remove last with count 05.
*/
@Test
public void testRemoveLastWithCount05()
{
StringList source = new StringList();
source.removeLast(1);
Assert.assertTrue(source.isEmpty());
source.removeLast(10);
Assert.assertTrue(source.isEmpty());
}
/**
* Test remove last with count 06.
*/
@Test
public void testRemoveLastWithCount06()
{
StringList source = new StringList();
source.append("un", "deux", "trois", "quatre", "cinq");
source.removeLast(1);
Assert.assertEquals(4, source.size());
Assert.assertEquals("quatre", source.getLast());
source.append("cinq", "six", "sept", "huit", "neuf", "dix");
source.removeLast(10);
Assert.assertTrue(source.isEmpty());
}
/**
* Test shrink 01.
*/

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2013,2014,2017-2018 Christian Pierre MOMON
* Copyright (C) 2013-2020 Christian Pierre MOMON
*
* This file is part of Devinsy-strings.
*
@ -56,17 +56,24 @@ public class StringsUtilsTest
{
Assert.assertTrue(StringsUtils.containsAny("abc", "aaa", "bbb", "abc"));
Assert.assertFalse(StringsUtils.containsAny("abc", "aaa", "bbb", "aBc"));
Assert.assertTrue(StringsUtils.containsAny("abc", new StringList("aaa", "bbb", "abc")));
Assert.assertFalse(StringsUtils.containsAny("abc", new StringList("aaa", "bbb", "aBc")));
}
/**
* Test contains any ignore case 01.
*/
@Test
public void testContainsAnyIgnoreCase01()
public void testContainsAnyIgnoreCatse01()
{
Assert.assertTrue(StringsUtils.containsAnyIgnoreCase("abc", "aaa", "bbb", "abc"));
Assert.assertTrue(StringsUtils.containsAnyIgnoreCase("abc", "aaa", "bbb", "aBc"));
Assert.assertFalse(StringsUtils.containsAnyIgnoreCase("abc", "aaa", "bbb", "ccc"));
Assert.assertTrue(StringsUtils.containsAnyIgnoreCase("abc", new StringList("aaa", "bbb", "abc")));
Assert.assertTrue(StringsUtils.containsAnyIgnoreCase("abc", new StringList("aaa", "bbb", "aBc")));
Assert.assertFalse(StringsUtils.containsAnyIgnoreCase("abc", new StringList("aaa", "bbb", "ccc")));
}
/**
@ -195,6 +202,154 @@ public class StringsUtilsTest
Assert.assertTrue(StringsUtils.containsNull(source));
}
/**
* Test count blank strings.
*/
@Test
public void testCountBlankStrings()
{
//
this.logger.debug("===== test starting...");
{
StringList source = new StringList();
Assert.assertEquals(0, StringsUtils.countBlankStrings(source));
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(0, StringsUtils.countBlankStrings(source));
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(2, StringsUtils.countBlankStrings(source));
}
//
this.logger.debug("===== test done.");
}
/**
* Test count blank strings.
*/
@Test
public void testCountNotBlankStrings()
{
//
this.logger.debug("===== test starting...");
{
StringList source = new StringList();
Assert.assertEquals(0, StringsUtils.countNotBlankStrings(source));
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(5, StringsUtils.countNotBlankStrings(source));
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(3, StringsUtils.countNotBlankStrings(source));
}
//
this.logger.debug("===== test done.");
}
/**
* Test count blank strings.
*/
@Test
public void testCountStrings()
{
//
this.logger.debug("===== test starting...");
{
StringList source = new StringList();
Assert.assertEquals(0, StringsUtils.countStrings(source, null));
}
{
StringList source = new StringList();
Assert.assertEquals(0, StringsUtils.countStrings(source, "a*"));
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(0, StringsUtils.countStrings(source, null));
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(5, StringsUtils.countStrings(source, ".*\\d.*"));
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(0, StringsUtils.countStrings(source, null));
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(3, StringsUtils.countStrings(source, ".*\\d.*"));
}
//
this.logger.debug("===== test done.");
}
/**
* Test ends with any 01.
*/
@Test
public void testEndsWithAny01()
{
Assert.assertTrue(StringsUtils.endsWithAny("abc", new StringList("aa", "bb", "bc")));
Assert.assertFalse(StringsUtils.endsWithAny("abc", new StringList("aa", "bb", "Bc")));
}
/**
* Test contains any ignore case 01.
*/
@Test
public void testEndsWithAnyIgnoreCatse01()
{
Assert.assertTrue(StringsUtils.endsWithAnyIgnoreCase("abc", new StringList("aa", "bb", "bc")));
Assert.assertTrue(StringsUtils.endsWithAnyIgnoreCase("abc", new StringList("aa", "bb", "Bc")));
Assert.assertFalse(StringsUtils.endsWithAnyIgnoreCase("abc", new StringList("aa", "bb", "cc")));
}
@Test
public void testEqualsAny01()
{
@ -209,6 +364,98 @@ public class StringsUtilsTest
Assert.assertTrue(StringsUtils.equalsAnyIgnoreCase("abc", "aaa", "bbb", "aBc"));
}
/**
* Test filter.
*/
@Test
public void testFilter()
{
//
this.logger.debug("===== test starting...");
{
StringList source = new StringList();
Assert.assertEquals(0, StringsUtils.filter(source, null).size());
}
{
StringList source = new StringList();
Assert.assertEquals(0, StringsUtils.filter(source, "a*").size());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(0, StringsUtils.filter(source, null).size());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(5, StringsUtils.filter(source, ".*\\d.*").size());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(0, StringsUtils.filter(source, null).size());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(3, StringsUtils.filter(source, ".*\\d.*").size());
}
//
this.logger.debug("===== test done.");
}
/**
* Test filter blank strings.
*/
@Test
public void testFilterBlankStrings()
{
//
this.logger.debug("===== test starting...");
{
StringList source = new StringList();
Assert.assertEquals(0, StringsUtils.filterBlankStrings(source).size());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(5, StringsUtils.filterBlankStrings(source).size());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(3, StringsUtils.filterBlankStrings(source).size());
}
//
this.logger.debug("===== test done.");
}
/**
* Test find smallest 01.
*/
@ -226,6 +473,193 @@ public class StringsUtilsTest
Assert.assertTrue(StringsUtils.containsNull(source));
}
/**
* Test is matching 01.
*
* @throws IOException
* Signals that an I/O exception has occurred.
*/
@Test
public void testIsMatching01() throws IOException
{
//
StringList source = null;
String[] regexps = null;
//
Assert.assertEquals(true, StringsUtils.isMatching(source, regexps));
}
/**
* Test is matching 02.
*
* @throws IOException
* Signals that an I/O exception has occurred.
*/
@Test
public void testIsMatching02() throws IOException
{
//
StringList source = new StringList();
String[] regexps = null;
//
Assert.assertEquals(true, StringsUtils.isMatching(source, regexps));
}
/**
* Test is matching 03.
*
* @throws IOException
* Signals that an I/O exception has occurred.
*/
@Test
public void testIsMatching03() throws IOException
{
//
StringList source = null;
String[] regexps = new String[0];
//
Assert.assertEquals(true, StringsUtils.isMatching(source, regexps));
}
/**
* Test is matching 04.
*
* @throws IOException
* Signals that an I/O exception has occurred.
*/
@Test
public void testIsMatching04() throws IOException
{
//
StringList source = new StringList();
String[] regexps = new String[0];
//
Assert.assertEquals(true, StringsUtils.isMatching(source, regexps));
}
/**
* Test is matching 05.
*
* @throws IOException
* Signals that an I/O exception has occurred.
*/
@Test
public void testIsMatching05() throws IOException
{
//
StringList source = new StringList("aaa", "bbb", "ccc");
String[] regexps = null;
//
Assert.assertEquals(false, StringsUtils.isMatching(source, regexps));
}
/**
* Test is matching 06.
*
* @throws IOException
* Signals that an I/O exception has occurred.
*/
@Test
public void testIsMatching06() throws IOException
{
//
StringList source = new StringList("aaa", "bbb", "ccc");
String[] regexps = new String[0];
//
Assert.assertEquals(false, StringsUtils.isMatching(source, regexps));
}
/**
* Test is matching 07.
*
* @throws IOException
* Signals that an I/O exception has occurred.
*/
@Test
public void testIsMatching07() throws IOException
{
//
StringList source = new StringList("aaa", "bbb", "ccc");
String[] regexps = new String[] { "^a+$" };
//
Assert.assertEquals(false, StringsUtils.isMatching(source, regexps));
}
/**
* Test is matching 08.
*
* @throws IOException
* Signals that an I/O exception has occurred.
*/
@Test
public void testIsMatching08() throws IOException
{
//
StringList source = new StringList("aaa", "bbb", "ccc");
String[] regexps = new String[] { "^a+$", "^b+$", "^c+$" };
//
Assert.assertEquals(true, StringsUtils.isMatching(source, regexps));
}
/**
* Test is matching 09.
*
* @throws IOException
* Signals that an I/O exception has occurred.
*/
@Test
public void testIsMatching09() throws IOException
{
//
StringList source = null;
String[] regexps = new String[] { "^a+$", "^b+$", "^c+$" };
//
Assert.assertEquals(false, StringsUtils.isMatching(source, regexps));
}
/**
* Test is matching 10.
*
* @throws IOException
* Signals that an I/O exception has occurred.
*/
@Test
public void testIsMatching10() throws IOException
{
//
StringList source = new StringList();
String[] regexps = new String[] { "^a+$", "^b+$", "^c+$" };
//
Assert.assertEquals(false, StringsUtils.isMatching(source, regexps));
}
/**
* Test is matching 11.
*
* @throws IOException
* Signals that an I/O exception has occurred.
*/
@Test
public void testIsMatching11() throws IOException
{
//
StringList source = new StringList("aaa");
String[] regexps = new String[] { "^a+$", "^b+$", "^c+$" };
//
Assert.assertEquals(false, StringsUtils.isMatching(source, regexps));
}
/**
* Load to string list URL 01.
*
@ -242,4 +676,25 @@ public class StringsUtilsTest
Assert.assertEquals(4, source.size());
Assert.assertEquals("trois", source.get(3 - 1));
}
/**
* Test starts with any 01.
*/
@Test
public void testStartsWithAny01()
{
Assert.assertTrue(StringsUtils.startsWithAny("abc", new StringList("aaa", "bb", "ab")));
Assert.assertFalse(StringsUtils.startsWithAny("abc", new StringList("aaa", "bb", "aB")));
}
/**
* Test contains any ignore case 01.
*/
@Test
public void testStartsWithAnyIgnoreCatse01()
{
Assert.assertTrue(StringsUtils.startsWithAnyIgnoreCase("abc", new StringList("aa", "bb", "ab")));
Assert.assertTrue(StringsUtils.startsWithAnyIgnoreCase("abc", new StringList("aa", "bb", "aB")));
Assert.assertFalse(StringsUtils.startsWithAnyIgnoreCase("abc", new StringList("aa", "bb", "cc")));
}
}