Ask Your Question
0

what is happening in that procedure? [closed]

asked 2014-05-16 13:57:49 +0200

altair gravatar image

updated 2014-05-16 14:02:32 +0200

karolus gravatar image

Hello! Please, what is happening in this function? (what is the result?)

Dim MyString As String 
MyString = "This was my text"
Mid(MyString, 6, 3, "is")

Many thanks!

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2016-02-22 17:39:28.633074

Comments

I tried to write it in sub in writer, but got error, so I dont't know what is wrong...

altair gravatar imagealtair ( 2014-05-16 18:15:42 +0200 )edit

I tried as mahfiaz said before I piosted it, but got error...

altair gravatar imagealtair ( 2014-05-16 18:17:48 +0200 )edit

Karolus, I appologise, had some technical problems in a hurry! Hope I managetd it now!

altair gravatar imagealtair ( 2014-05-16 18:54:31 +0200 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2014-05-16 14:13:24 +0200

mahfiaz gravatar image

You just let the MID() function calculate the new value, but then you do nothing with it: Mid(MyString, 6, 3, "is")

To see the value or use it somewhere you need to assign it to a variable, e.g MyString = MID(...) and MsgBox(MyString)

edit flag offensive delete link more

Comments

Hello! I wrote:

sub x
Dim Mystring As String
Mystring="This was my text"
print Mid(Mystring, 6, 3, "is")

end sub

Please, tell me if it is marked as code correctly, I clicked 101 010, but have some problems on the screen

altair gravatar imagealtair ( 2014-05-16 18:30:12 +0200 )edit

Hey, you finally convinced me to try it out. Looks like MID() statement (as wiki puts it, https://help.libreoffice.org/Basic/Mi... ) does not work and returns empty string. Please write a bug report about this and post a link here as well. In the meantime you could do:

Mystring = "This was my text"
Mystring = Left(Mystring, 5) & "is" & Right(Mystring, Len(Mystring) - 6 - 2)
mahfiaz gravatar imagemahfiaz ( 2014-05-16 23:41:07 +0200 )edit

Question Tools

1 follower

Stats

Asked: 2014-05-16 13:57:49 +0200

Seen: 58 times

Last updated: May 16 '14