Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

HELP WITH JAVA 101

Name: Anonymous 2009-02-12 14:43

Can someone help me write a Java program that does this?
It simply changes the word "hate" to "love"

Enter a sentence containing the word "hate":
hate is such a strong word

Your revised sentence is:
love is such a strong word

Name: Anonymous 2009-02-12 14:54

Can someone help me

No.

Name: Anonymous 2009-02-12 15:06

print qq{Enter a sentence containing the word "hate":\n};
(my $word=<>)=~s/hate/love/g;
print qq{\nYour revised sentence is:\n$word\n};


Enjoy

Name: Anonymous 2009-02-12 15:11

replace :: Eq a => [a] -> [a] -> [a] -> [a]
replace [] _ _ = []
replace s find repl | take (length find) s == find = repl ++ (replace (drop (length find) s) find repl)
                    | otherwise                    = [head s] ++ (replace (tail s) find repl)

main = putStrLn $replace "hate is such a strong word" "hate" "love"

Name: Anonymous 2009-02-12 15:17

>>4
[head s] ++
ಠ_ಠ

Name: Anonymous 2009-02-12 15:21

>>5
AYHBTC                   .

Name: Anonymous 2009-02-12 15:22

>>3
>>4

could you please elaborate on these?

Name: Anonymous 2009-02-12 15:23

>>7
What seems to be the problem?

Name: Anonymous 2009-02-12 15:24

>>7
What seems to be the officer?

Name: Anonymous 2009-02-12 15:25

>>8
Haskell.

Name: Anonymous 2009-02-12 15:34

>>10
No dogs around here.

Name: Anonymous 2009-02-12 16:07

>>8

i need strings

Name: Anonymous 2009-02-12 16:19

>>12
Here you go:
char * aString;
char * anotherString;

Name: Anonymous 2009-02-12 16:21

>>13
fuck you

Name: Anonymous 2009-02-12 16:22

>>14
Fuck you.

Name: Anonymous 2009-02-12 16:25

>>15
op here,

chill the fuck out.

Name: Anonymous 2009-02-12 16:26

typedef char * string

Name: Anonymous 2009-02-12 16:27

OP here. Nevermind, I figured it out.

Name: Anonymous 2009-02-12 16:28

char* is considered harmful in any program written after 2000. Use either wchar_t or wstring.

Name: Anonymous 2009-02-12 16:31

>>19
What do you mean by "harmful?"

Name: Anonymous 2009-02-12 16:33

>>20
Adj. causing or tending to cause harm, esp. to a person's health

Name: Anonymous 2009-02-12 16:37

>>19
cool joke bro

Name: Anonymous 2009-02-12 16:38

>>20
LURK THE FUCK MORE

Name: Anonymous 2009-02-12 16:43

>>19
If you don't need unicode support, or need to interoperate with libraries/applications which use plain ASCIIZ representation, char* just fits the job, and char by itself is nothing more than a signed byte.

Name: Anonymous 2009-02-12 18:08

>>24
Signed? Why is char signed?

Name: Anonymous 2009-02-12 19:15

op here,

will someone please give me the code already?

Name: Anonymous 2009-02-12 19:17

>>26
I believe >>3,4 provided.

Name: Anonymous 2009-02-12 19:18

>>26
Do your own homework, for fuck's sake this is retardedly simple.

Name: Anonymous 2009-02-12 19:18

>>26
Try StringRefactorFactoryBuilder

Name: Anonymous 2009-02-12 19:36

Pattern.compile("hate").matcher("hate is such a strong word").replaceAll("love"); now GET OUT

Name: Anonymous 2009-02-12 20:24

>>30

>now GET OUT

i hate fags.

Name: Anonymous 2009-02-12 20:27

>>30
I hope you're proud of yourself.

Name: Anonymous 2009-02-12 22:29

>>31
Homophobe detected

Name: Anonymous 2009-02-12 22:31

public static String TransformHateToLove(String inText)
 throws TextTransformException
 {
   TextTransform<String> hateToLoveTransform = TextTransformFactory.getInstance().createUserSpecifiedTextTranform<String>(TextTransformTypeFactory.getInstance().transformType(TextTransformTypes.TEXT_TRANSFORM_REPLACE|TextTransformTypes.TEXT_TRANFORM_CULTURE_INVARIANT),new CultureInvariantTextTransformAdapter<string>(new TextTransformInputStream<string>(inText),new TextTransformOutputStream<string>(),new TextTransformSourcePattern("hate",TextTransformSourcePattern.TEXT_TRANSFORM_PATTERN_INVARIANT),new TextTransformSinkPattern("love",TextTransformSinkPattern.TEXT_TRANSFORM_PATTERN_INVARIANT)));
  return hateToLoveTransform.execute();
 }

Name: Anonymous 2009-02-12 22:52

main:
    leal    4(%esp), %ecx
    andl    $-16, %esp
    pushl    -4(%ecx)
    pushl    %ebp
    movl    %esp, %ebp
    pushl    %ecx
    subl    $292, %esp
    movl    %gs:20, %eax
    movl    %eax, -8(%ebp)
    xorl    %eax, %eax
    jmp    .L2
.L3:
    leal    -264(%ebp), %eax
    movl    %eax, (%esp)
    call    love
.L2:
    movl    $255, 8(%esp)
    leal    -264(%ebp), %eax
    movl    %eax, 4(%esp)
    movl    $0, (%esp)
    call    read
    testl    %eax, %eax
    jg    .L3
    movl    $0, %eax
    movl    -8(%ebp), %edx
    xorl    %gs:20, %edx
    je    .L6
    call    __stack_chk_fail
.L6:
    addl    $292, %esp
    popl    %ecx
    popl    %ebp
    leal    -4(%ecx), %esp
    ret
    .size    main, .-main
    .section    .rodata
.LC0:
    .string    "love"
    .text
.globl love
    .type    love, @function
love:
    pushl    %ebp
    movl    %esp, %ebp
    subl    $40, %esp
    movl    $0, -8(%ebp)
    movl    .LC0, %eax
    movl    %eax, -12(%ebp)
    jmp    .L8
.L9:
    movl    8(%ebp), %eax
    movzbl    (%eax), %eax
    cmpb    $72, %al
    je    .L10
    movl    8(%ebp), %eax
    movzbl    (%eax), %eax
    cmpb    $104, %al
    jne    .L12
.L10:
    addl    $1, 8(%ebp)
    addl    $1, -8(%ebp)
    movl    8(%ebp), %eax
    movzbl    (%eax), %eax
    cmpb    $65, %al
    je    .L13
    movl    8(%ebp), %eax
    movzbl    (%eax), %eax
    cmpb    $97, %al
    jne    .L8
.L13:
    addl    $1, 8(%ebp)
    addl    $1, -8(%ebp)
    movl    8(%ebp), %eax
    movzbl    (%eax), %eax
    cmpb    $84, %al
    je    .L16
    movl    8(%ebp), %eax
    movzbl    (%eax), %eax
    cmpb    $116, %al
    jne    .L8
.L16:
    addl    $1, 8(%ebp)
    addl    $1, -8(%ebp)
    movl    8(%ebp), %eax
    movzbl    (%eax), %eax
    cmpb    $69, %al
    je    .L18
    movl    8(%ebp), %eax
    movzbl    (%eax), %eax
    cmpb    $101, %al
    jne    .L8
.L18:
    movl    $0, -4(%ebp)
    subl    $3, 8(%ebp)
    jmp    .L20
.L21:
    movl    -4(%ebp), %eax
    movzbl    -12(%ebp,%eax), %edx
    movl    8(%ebp), %eax
    movb    %dl, (%eax)
    addl    $1, -4(%ebp)
    addl    $1, 8(%ebp)
.L20:
    cmpl    $3, -4(%ebp)
    jle    .L21
    addl    $1, -8(%ebp)
    jmp    .L8
.L12:
    addl    $1, 8(%ebp)
    addl    $1, -8(%ebp)
.L8:
    movl    8(%ebp), %eax
    movzbl    (%eax), %eax
    cmpb    $10, %al
    jne    .L9
    movl    -8(%ebp), %eax
    subl    %eax, 8(%ebp)
    movl    -8(%ebp), %eax
    addl    $1, %eax
    movl    %eax, 8(%esp)
    movl    8(%ebp), %eax
    movl    %eax, 4(%esp)
    movl    $1, (%esp)
    call    write
    leave
    ret

Name: Anonymous 2009-02-12 22:53

>>33
your gay

Name: Anonymous 2009-02-12 23:14

>>36
What about >>33's you're gay?

Name: Anonymous 2009-02-12 23:30

>>37
Its very happy.

Name: Anonymous 2009-02-13 1:46

>>38
Its very happy's gay what?

Name: Anonymous 2009-02-13 2:09

>>39
Its very happy gay GUI's.

Name: Anonymous 2009-02-13 2:11

public static String loveToHate(String text) {
    return text.replaceAll("love","hate");
}

Name: Anonymous 2009-02-13 11:11

>>35
That code is completely unreadable.

Please use proper [code] tags from now on.

Name: Anonymous 2009-02-13 13:25

>>34
if you make this code readable and less complicated i will blow you.

Name: Anonymous 2009-02-13 13:48

>>42
I wish, it's machine code.

Name: Anonymous 2009-02-13 20:13

>>44
_\x81?loveu\xF8\xC7\x47hate\xEB\xF0

Name: Anonymous 2009-02-13 20:16

>>45
lol, forgot my G.

But then the jump addresses will be wrong ;_;

Name: Anonymous 2009-03-06 10:29


Is the way to   make a useless   and stupid endeavor   Aside from random   import choice randint   def randsent x.

Name: Anonymous 2010-11-13 16:07

Don't change these.
Name: Email:
Entire Thread Thread List