Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add files via upload #192

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added S23/pmirukula/Conversion.class
Binary file not shown.
44 changes: 44 additions & 0 deletions S23/pmirukula/Conversion.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.*;
import java.util.Locale;

public class Conversion {
public void conversionlogic()
{
}

PMIRUKULA marked this conversation as resolved.
Show resolved Hide resolved
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Please enter the word");
String str = br.readLine();
System.out.println("Please enter the language you would like to translate the word");
String str_lang = br.readLine();
PrintWriter out = new PrintWriter("oceans.txt");
PMIRUKULA marked this conversation as resolved.
Show resolved Hide resolved
String output = str.toLowerCase(new Locale(str_lang));
if(str_lang == " tr " || str_lang == "az")
PMIRUKULA marked this conversation as resolved.
Show resolved Hide resolved
{
if(str.contains("I"))
{
str = str.replaceAll("I", " \0u131");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you test this? Looks like a bug. And also a magic number.

output = str.toLowerCase(new Locale(str_lang));
}
}
else if(str_lang.equals("ga-IE")|| str_lang.equals("ga") )
PMIRUKULA marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BCP-47 codes can be very complicated. This is far from general enough.

{

if((str.charAt(0) == 'n' || str.charAt(0) == 't')&& (str.charAt(1) == 'A' || str.charAt(1) == 'E' || str.charAt(1) == 'I' || str.charAt(1) == 'O'
|| str.charAt(1) == 'U'|| str.charAt(1) == 'Ó' || str.charAt(1) == 'Á' ||str.charAt(1) == 'É' || str.charAt(1) == 'Ú' ||str.charAt(1) == 'Í'))
PMIRUKULA marked this conversation as resolved.
Show resolved Hide resolved

{

output = output.substring(0,1) + "-" + output.substring(1);
}

}
out.println(output);
out.close();
}

}
23 changes: 23 additions & 0 deletions S23/pmirukula/updatedtests.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
HELLO en hello
WORLD en-US world
cAmEl en-IE camel
---OK en-Latn ---ok
tAcht ga t-acht
tACHT ga t-acht
TACHT ga tacht
nAthair ga n-athair
nATHAIR ga n-athair
NATHAIR ga nathair
nÓg ga-IE n-óg
nÕg ga-IE nõg
nÕg ga-IE nõg
KASIM tr kasım
KASIM en kasim
ΠΌΛΗ el πόλης
官话 zh-Hans 官话
ภาษาไทย th ภาษาไทย
nATHAIR ga n-athair
nAr ga n-ar
ภาษาไท th ภาษาไท
Σ el σ