Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

/ * * return the length of a given string * return - 1 is the string is null * / public static int returnTheLengthOfTheString

/*
* return the length of a given string
* return -1 is the string is null
*/
public static int returnTheLengthOfTheString(String word){
String numberChas ="//d|//w";
return -1;
} Please use regex in java to write code to check and return the length of a string Below are the strings being checked System.out.println(StringRegExAssignment.returnTheLengthOfTheString("")); //0
System.out.println(StringRegExAssignment.returnTheLengthOfTheString("a")); //1
System.out.println(StringRegExAssignment.returnTheLengthOfTheString("The Annual Convention of UPE will held in cyberspace on Friday, March 25,2022, from 1-3 PM")); //92
System.out.println(StringRegExAssignment.returnTheLengthOfTheString(null)); //-1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database Technology

Authors: Suad Alagic

1st Edition

354096276X, 978-3540962762

More Books

Students also viewed these Databases questions