I am a beginner in the IT field and I have a question.
I would like to have some hints about how to define a procedure for a txt file (in C+, VB.net, DOS or what else) that executes the same function as Standard Microsoft program does when you use the Edit menu and do “Find and Replace”.
Can someone help me to address this issue?
Thanks
Luca
1 1210 PEB 1,418
Recognized Expert Top Contributor
Hi,
So welcome in the IT domain!
You have right that this is good to be stored like a procedure or function!
In VB in the procedures you can store an algoritme but this algoritme don't give result!
The procedures are declared like:
Sub find_replace(Se arch_string, Replace_String, Match_case, FInd_whole_word s_only)
Algoritme
End sub
And there is no result when they are executed!
They are called frome your code like:
find_replace(Se arch_string, Replace_String, Match_case, FInd_whole_word s_only)
In the construction of functions there is result that is returned!
Function find_replace(Se arch_string, Replace_String, Match_case, FInd_whole_word s_only) AS Longint
Algoritme
find_replace=nu mber_of_replace ments
Function sub
The function can be called like:
Msgbox "Word has made ;" & str(find_replac e(Search_string , Replace_String, Match_case, FInd_whole_word s_only)) & " replacements"
Usually the functions and procedures are wrotten in modules. It depend of the destination of the functions and procedures...
When the respective module is loaded in your program you can use the specified function or procedure stored on it...
To facilitate the programers that write on different languages, many of the languages have the option to create a module on the respective language as dll
dinamic linked library!
One time your module in dll, you can use it in other languages to program!
In Windows there is a lot of dll... You need to know what functions and procedures you have and their parameters in the respective dll for use them!
For find and replace as function in windows you need to search in what dll is stored and what are the parameters...
Then in the respective4 language you need to check how to declare a dll function or procedure and it's all!
Best regards!
:)
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: hokieghal99 |
last post by:
import os, string
print " "
setpath = raw_input("Enter the path: ")
def find_replace(setpath):
for root, dirs, files in os.walk(setpath):
fname = files
for fname in files:
find = string.find(file(os.path.join(root,fname),
'rb').read(), 'THIS')
print find
|
by: Bart Nessux |
last post by:
x = str.find(temp, '120.50')
I am looking for '120.50' '120.51' '122.78' etc. How can I do this with
just one str.find... I can use re if I must, but I'd like to avoid it if
possible.
|
by: Xah Lee |
last post by:
suppose you want to do find & replace of string of all files in a
directory.
here's the code:
©# -*- coding: utf-8 -*-
©# Python
©
©import os,sys
©
©mydir= '/Users/t/web'
|
by: Daniel |
last post by:
I use an Access database to basically take data exports, import them,
manipulate the data, and then turn them into exportable reports. I do
this using numerous macros, and queries to get the data in the format
that I need it in order to create the reports that we use. So far this
has proven to be successful for the reports that I am doing and the
data that I am pulling into it. I just have one challenge that may
require a lot of work and I...
|
by: James Vitale |
last post by:
Using vb asp.net 1.1
I'm doing a word automation on a doc file and trying to do a find and
replace. My existing code works fine except that it doesn't find and
replace in the header.
My code to set the selection is as follows:
'This sets the selection to be the whole document
| |
by: Xah Lee |
last post by:
Interactive Find and Replace String Patterns on Multiple Files
Xah Lee, 2006-06
Suppose you need to do find and replace of a string pattern, for all
files in a directory. However, you do not want to replace all of them.
You need to look at it in a case-by-case basis. What can you do?
Answer: emacs.
|
by: Rave |
last post by:
This is a long shot, but I thought I'd try it. I am currently using excel as an inventory tool. I currently have a hand-held scanner plugged into a laptop for reading barcodes. Using the "Find and Replace" fuction, I scan the merchandise which then searches the spreadsheet for the matching inventory number. When it is found, I highlight that cell in yellow. After scanning and coloring all of my inventory I can then see exactly what is...
|
by: john |
last post by:
In a table I have text field A. I would like to replace all the null values
in field A to a real value, let's say 'Test'. When I use Find & Replace and
I search for 'is null' and I press replace or replace all, no null value is
found, so I can't replace anything. However, when I press Find Next in that
same dialog then the null values are found.
Anyone and idea what is happening here?
Thanks,
john
|
by: TOXiC |
last post by:
Hi everyone,
First I say that I serched and tryed everything but I cannot figure
out how I can do it.
I want to open a a file (not necessary a txt) and find and replace a
string.
I can do it with:
import fileinput, string, sys
fileQuery = "Text.txt"
sourceText = '''SOURCE'''
|
by: mouac01 |
last post by:
Newbie here. How do I do a find and replace in a binary file? I need
to read in a binary file then replace a string "ABC" with another
string "XYZ" then write to a new file. Find string is the same length
as Replace string. Here's what I have so far. I spent many hours
googling for sample code but couldn't find much. Thanks...
public static void FindReplace(string OldFile, string NewFile)
{
string sFind = "ABC"; //I probably need...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |