I haved wrote a next code to find a replace strings, I need to use this code to find "=" and replace with tab key, I trying with "\t" but this doesn't work, Could you help me please? What is a character tab key for use in macro of openoffice?
Public Function findReplace(oDoc As Object, findStr As String, replaceStr As String) As Integer
oSearch = oDoc.createSearchDescriptor
oSearch.searchAll = False
oSearch.SearchString = findStr
oSearch.ReplaceString = replaceStr
oDoc.replaceAll(oSearch)
End Function
alfetta is right - just enable RegularExpression
oSearch.SearchRegularExpression = TRUE
to have \t as replaceStr working, replacing with a Tab.
You should be able to find a tab with Search and Replace using \t with "Regular Expressions" checked
after starting Find & Replace StrgF
Related
I have a submit form where there are multiple textfields.
Whenever user enters text like "Hi, my name is "xyz"", the service does not accept this JSON due to double quotes in my string.
Please suggest ways to escape this character.
I have tried using encode and decode JSON, replaceOccurrencesOf methods, but none work.
replaceOccurrencesOf()
The below code snippet with replace "(double quote) in a string by \". This will help to replace "(double quote) by any string or character in a given string.
Swift 5 or above
let replacedString = stringToBeModified.replacingOccurrences(of: "\"", with: #"\""#)
Instead of putting the name (i.e., "XYZ" if you getting xyz from textfield ) why not to place (textField.text!) it will not put extra " "
So I am trying to come up with a method that will allow clean URL's only and make the string empty if it contains any character(s) it should not.
Whitelist of Characters i want the url to accept only
A-Z a-z 0-9 _ - . /
Lua Code Example :
local bar = "com/url/index.php/html/path/stuff.html.html123/..lol"
bar = bar:gsub("%.html.*$","")
bar = bar:gsub("%/$","")
bar = bar:gsub("%.$","")
print(bar)
--TODO: if characters not in whitelist then make bar empty
bar = ""
Clean output:
com/url/index.php/html/path/stuff
Dirty output: (This is what I want to get rid of because characters not whitelisted or multiple unnecessary slashes)
com/url///////index.php/html//////path///////stuff
com/url///////+index.php/=html//////path///////stuff#[
I'm not sure what you mean. Try this.
if bar:gsub("[A-Za-z0-9_%-%./]","")=="" then
-- bar is ok
else
bar=""
end
According to the DOORS Reference Manual, this code will print the source module identification of an inlink:
Object o = current
string srcModName
for srcModName in o<-"*" do print srcModName "\n"
This does work, however what I'm trying to do is print the target module identification of an outlink. I thought simply switching o<- to o-> would do the trick, but it doesn't. Does anyone know why, and how to fix this?
Not sure why that doesn't work but this does:
Object o = current
string tgtMod
Link l
for l in o -> "*" do
{
tgtMod = target(l)
print tgtMod "\n"
}
It doesn't work simply because there is no loop construct with that signature. All you have to work with is what's listed in the DXL Reference Manual.
EDIT: I forgot to mention though that Steve's answer is the way to do it if you just want the name of the target module.
For example, say I wanted to determine whether this form was storing newlines as carriage returns or newlines or whatever characters. I'm often in situations where I'm writing code and am not sure what type of new-line character a file/form/whatever I'm parsing is using.
How could I determine this? Is there a way to determine this without actually doing a check inside of code? (It seems like I should be able to right-click and "show all characters" or something like that).
Note: I realize I could write code saying
(if == '\r') cout << "Carriage";
etc
but I have a feeling there's a simpler solution.
Maybe is list what you are looking for (from vim help):
:[range]l[ist] [count] [flags]
Same as :print, but display unprintable characters
with '^' and put $ after the line. This can be
changed with the 'listchars' option.
See ex-flags for [flags].
You can switch modes with:
:set list
and
:set nolist
Additionally you can use "listchars" as shown in this example:
You could for example check your document for occourences of "Carriage Return" or "New Line"/"Line Feed".
e.g. (php):
if( strstr( $yourstring , "\r" ) != false ){ // You have Carriage return
// Do something
}
elseif( strstr( $yourstring , "\n" ) != false ){ // You have New Line/Line feed
// Do something
}
else{
// You cannot determine which on is used, because the string is single-lined
}
I hope this is the thing you're looking for
Note: In windows "\r\n" is used to specify ne lines
I have an expression statement to display content for a text box for a reportviewer but went blank when trying to add a carriage return or a new line between the two expression. My expression as follows:
=Format(Fields!LastDateVisited.Value, "d")+ " "+Fields!LastVisitType.Value
Instead of the space i want to make it a new line. I tried "\n" but didn't work, any suggestions would be great. Thanks!
You can also use following :
= Fields!FirstField1.Value + System.Environment.NewLine + Fields!MyField2
I think that a end of line character should work: '\n'
in your placeholder properties (Expr page) change the markup type to html