replace.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 #pragma once
6 
7 #include <cudf/column/column.hpp>
8 #include <cudf/scalar/scalar.hpp>
11 
17 namespace CUDF_EXPORT cudf {
18 namespace strings {
58 std::unique_ptr<column> replace(
59  strings_column_view const& input,
60  string_scalar const& target,
61  string_scalar const& repl,
62  cudf::size_type maxrepl = -1,
65 
100 std::unique_ptr<column> replace_slice(
101  strings_column_view const& input,
102  string_scalar const& repl = string_scalar(""),
103  size_type start = 0,
104  size_type stop = -1,
107 
137 std::unique_ptr<column> replace(
138  strings_column_view const& input,
139  strings_column_view const& targets,
140  strings_column_view const& repls,
143 
183 std::unique_ptr<column> replace_multiple(
184  strings_column_view const& input,
185  strings_column_view const& targets,
186  strings_column_view const& repls,
189  // end of doxygen group
191 } // namespace strings
192 } // namespace CUDF_EXPORT cudf
An owning class to represent a string in device memory.
Definition: scalar.hpp:411
Given a column-view of strings type, an instance of this class provides a wrapper on this compound co...
Class definition for cudf::column.
rmm::cuda_stream_view const get_default_stream()
Get the current default stream.
rmm::device_async_resource_ref get_current_device_resource_ref()
Get the current device memory resource reference.
cuda::mr::resource_ref< cuda::mr::device_accessible > device_async_resource_ref
std::unique_ptr< column > replace_multiple(strings_column_view const &input, strings_column_view const &targets, strings_column_view const &repls, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Replaces substrings matching a list of targets with the corresponding replacement strings.
std::unique_ptr< column > replace_slice(strings_column_view const &input, string_scalar const &repl=string_scalar(""), size_type start=0, size_type stop=-1, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
This function replaces each string in the column with the provided repl string within the [start,...
std::unique_ptr< column > replace(strings_column_view const &input, strings_column_view const &targets, strings_column_view const &repls, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Replaces, per row, all occurrences of targets[i] within input[i] with repls[i].
int32_t size_type
Row index type for columns and tables.
Definition: types.hpp:84
APIs for getting and setting the current device memory resource.
cuDF interfaces
Definition: host_udf.hpp:26
Class definitions for cudf::scalar.
Class definition for cudf::strings_column_view.